#==============================================================================
# DerVVulfman's Limit Break Menu v 2.7
# By Alistor, with Edits by DerVVulfman
# Original Concept by SephirothSpawn
#==============================================================================
# This script has an Auto-Detect function that, when used with SDK, replaces the
# internal Window_HorizCommand with the SDK version. Thanks go to DerVVulfman for that
# method. Added a second Auto-Detect function that, when used with the Attack Replacer LB
# Add-On, removes limits from the skill window in battle and vice-versa.
#==============================================================================
#=======================================================================#
# ** C O N F I G U R A T I O N S Y S T E M ** #
#=======================================================================#
# Allows you to hide SP values of zero:
# =====================================
HIDE_ZERO_SP = true
# Basic Menu Text:
# ================
LB_MENU_TITLE = 'Limits' # Menu Title
LB_HEADING_1 = 'View Limits' # Option 1 Text: List of Limit Break Skills
LB_HEADING_2 = 'Set Gain Mode' # Option 2 Text: List of Limit Break Types
# Preset Gain Mode Help Text System:
# =================================+
# This customizes the text shown after you choose the limit break style for an
# actor. Originally hardwired, you can now edit the layout right here.
#
# {lb_a_name} :Actor's Name
# {lb_a_type} :Actor's Gain Mode Text (Limit Type)
LB_GAIN_TEXT = "{lb_a_name}'s Gain Mode is Now {lb_a_type}"
# - Sample output: Aluxes's Gain Mode is now Stotic -
#
# Optionally, you could have it be this:
# LB_GAIN_TEXT = "Gain Mode of {lb_a_type} now set to {lb_a_name}"
# - Sample output: Gain Mode of Victor now set to Gloria -
# Array of Limit Break types:
# ===========================
# This allows you to list the limit break styles or settings available in your
# system. You can choose to list them in any order and pick and choose whether
# a limit break style will even be in your game. You no longer have to use
# 'all' the limit break types available. And as such, this system is already
# designed to accomodate any newer limit break types not yet available.
#
# Idx: The index/setting of a 'limit break type' as defined by LB_START
# Type Name: The basic choice/option of a 'limit break type' in the menu
# Type Desc: A help text description of a 'limit break type'
#
# FORMAT:
# LB_MENU_ARRAY = [ [Limit Array], [Limit Array],... ]
# with...
# Limit Array = [Idx(as number), Type Name(as string), Type Desc(as string)]
#
# NOTE: The array can be set in any order, so the menu options can be arranged
# in any order. What controls the limit break type in use is the 'Idx'
# number in the array.
#
# Idx Type Name Type Desc
LB_MENU_ARRAY = [ [0, 'Warrior', 'Warrior - Gains When Hero Damages Enemy'] ,
[1, 'Heavy Hitter', 'Heavy Hitter - Gains When Hero Lands a Critical Hit'],
[2, 'Stoic', 'Stoic - Gains When Hero Receives Damage'] ,
[3, 'Slayer', 'Slayer - Gains When Hero Kills Enemy'],
[4, 'Godslayer', 'GodSlayer - Gains When Hero Defeats a Boss'],
[5, 'Victim', 'Victim - Gains When Hero is Slain'],
[6, 'Victor', 'Victor - Gains When Party Wins Battle'],
[7, 'Coward', 'Coward - Gains When Hero Escapes Battle'],
[8, 'Defender', 'Defender - Gains When Hero Chooses to Guard'],
[9, 'Loner', 'Loner - Gains When Hero Is Only Member in Party'],
[10, 'Active', 'Active - Gains When Hero Performs an Action'],
[11, 'Daredevil', 'Daredevil - Gains When Hero is in Critical Condition'] ]
#=======================================================================#
# C O N F I G U R A T I O N S Y S T E M E N D #
#=======================================================================#
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :lb_attack_detected
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lbadd1_init initialize
def initialize
lbadd1_init
if @lb_height != nil
@lb_attack_detected = true
end
end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :seperation # Seperation flag
attr_accessor :limitbreak_skills # Limit Break skill flag
attr_accessor :limit_menu # Limit Break menu flag
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lbadd1_init initialize
def initialize
lbadd1_init
@seperation = true
@limitbreak_skills = false
@limit_menu = false
end
end
#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill and battle screens.
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
unless $gnd_lb_patch
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
unless @actor == nil
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
unless skill == nil
if $game_temp.seperation
if $game_temp.limitbreak_skills
@data.push(skill) if skill.element_set.include?($lb_element_id)
else
@data.push(skill) unless skill.element_set.include?($lb_element_id)
end
else
@data.push(skill)
end
end
end
end
# If item count is not 0, make a bit map and draw all items
@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
$game_temp.seperation = true
$game_temp.limitbreak_skills = false
end
end
#--------------------------------------------------------------------------
# * Draw 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
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)
unless HIDE_ZERO_SP && skill.sp_cost == 0
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
#--------------------------------------------------------------------------
# * Check Data
#--------------------------------------------------------------------------
def data
return @data
end
end
#==============================================================================
# ** Window Horizontal Command (conditional on SDK system)
#------------------------------------------------------------------------------
# This window deals with general command choices, horizontally.
#==============================================================================
# If no SDK exists...
if !$lbadd_menu_sdk
# Use the Non-SDK system
class Window_HorizCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(commands, width = 640, height = 64)
super(0, 0, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
@commands = commands
@item_max = @commands.size
@column_max = @commands.size
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
x = width / @item_max * index
off = width / @item_max - 32
self.contents.draw_text(x, 0, off, 32, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
end
#==============================================================================
# ** Scene_LimitMenu
#------------------------------------------------------------------------------
# This class performs limit break screen processing.
#==============================================================================
class Scene_LimitMenu
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
# Attach the Limit Menu flag
$game_temp.limit_menu = true
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
if @actor_index < $game_party.actors.size
@actor = $game_party.actors[@actor_index]
else
@actor = $game_party.reserve_actors[@actor_index - $game_party.actors.size]
end
# Make Help Window
@help_window = Window_Help.new
# Command Window
# If the SDK is disabled
if $lbadd_menu_sdk
@command_window = Window_HorizCommand.new(640, [LB_HEADING_1, LB_HEADING_2])
else
@command_window = Window_HorizCommand.new([LB_HEADING_1, LB_HEADING_2])
end
@command_window.y = 128
# Skill Window
@skill_window = Window_Skill.new(@actor)
@skill_window.y = 192
@skill_window.height = 288
$game_temp.seperation = true
$game_temp.limitbreak_skills = true
@skill_window.refresh
@skill_window.active = false
# Skill Status Window
@status_window = Window_SkillStatus.new(@actor)
@status_window.y = 64
# Limit Break Types Window
@lb_type_window = Window_Limit_Types.new
@lb_type_window.y = 192
@lb_type_window.index = @actor.lb_type
@lb_type_window.visible = @lb_type_window.active = false
# Associate help window
if @skill_window.help_window == nil
@help_window.set_text(LB_MENU_TITLE, 1)
else
@skill_window.help_window = @help_window
end
# Scene Objects
@objects = [@help_window, @command_window, @skill_window, @lb_type_window, @status_window]
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Objects Update
@objects.each {|x| x.update}
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of Objects
@objects.each {|x| x.dispose}
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If Main Command Active : call update_main
if @command_window.active
update_main
return
end
# If skill window is active: call update_skill
if @skill_window.active
update_skill
return
end
# If Limit Type is active: call update_type
if @lb_type_window.active
update_type
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if main window is active)
#--------------------------------------------------------------------------
def update_main
# Toggles Windows Visiblity
@skill_window.visible = @command_window.index == 0 ? true : false
@lb_type_window.visible = @command_window.index == 1 ? true : false
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(7)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch Point
case @command_window.index
when 0 # View Skills
if @skill_window.data.size == 0
$game_system.se_play($data_system.buzzer_se)
@help_window.set_text(LB_MENU_TITLE, 1)
else
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@skill_window.active = true
end
when 1 # Set Limit Break Type
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@lb_type_window.active = true
@help_window.set_text(@lb_type_window.help_text, 1)
end
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_LimitMenu.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_LimitMenu.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if main window is active)
#--------------------------------------------------------------------------
def update_skill
# Refreshes Help Window Text
@skill_window.help_window = @help_window
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@help_window.set_text(LB_MENU_TITLE, 1)
# Switch to main menu
@command_window.active = true
@skill_window.active = false
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if main window is active)
#--------------------------------------------------------------------------
def update_type
# Refreshes Help Window Text (if triggered once or pressed continuously)
if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) ||
Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT) ||
Input.press?(Input::UP) || Input.press?(Input::DOWN) ||
Input.press?(Input::RIGHT) || Input.press?(Input::LEFT)
@help_window.set_text(@lb_type_window.help_text, 1)
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@help_window.set_text(LB_MENU_TITLE, 1)
# Switch to main menu
@command_window.active = true
@lb_type_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play cancel SE
$game_system.se_play($data_system.decision_se)
# Retrieve Limit Type from array
actor_lb_type = LB_MENU_ARRAY[@lb_type_window.index][0]
# Set Actor Limit Type
@actor.lb_type = actor_lb_type
# Set the character's gain text
lb_a_name = @actor.name
lb_a_type = LB_MENU_ARRAY[@lb_type_window.index][1]
text = LB_GAIN_TEXT.dup
begin
text[/{lb_a_name}/] = "#{lb_a_name}"
rescue
end
begin
text[/{lb_a_type}/] = "#{lb_a_type}"
rescue
end
@help_window.set_text(text, 1)
return
end
end
end
#==============================================================================
# ** Window_Limit_Types
#------------------------------------------------------------------------------
# This window displays the available limit types on the limit break screen.
#==============================================================================
class Window_Limit_Types < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 288)
@column_max = 2
@data = []
for i in 0...LB_MENU_ARRAY.size
@data.push(LB_MENU_ARRAY[1])
end
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Get Type
#--------------------------------------------------------------------------
def get_type
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Help Text
#--------------------------------------------------------------------------
def help_text
for i in 0...LB_MENU_ARRAY.size
text = LB_MENU_ARRAY[2] if LB_MENU_ARRAY
0 == index
end
return text
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# If item count is not 0, make a bit map and draw all items
@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
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
self.contents.draw_text(x, y, contents.width / 2 - 32, 32, @data[index], 1)
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias lbmenu_main main
def main
# Autodetect value added
@lb_menu = true
# Perform the original call
lbmenu_main
end
#--------------------------------------------------------------------------
# * Start Skill Selection
#--------------------------------------------------------------------------
unless $gnd_lb_patch
def start_skill_select
# RTAB detection value built into Limit Break (DVV)
# Assigns 'battler' value for the Skill Window.
if $game_system.lb_rtab_detected
battler = @active_actor
else
battler = @active_battler
end
# Make skill window
@skill_window = Window_Skill.new(battler)
if $game_system.lb_attack_detected
$game_temp.seperation = true
$game_temp.limitbreak_skills = false
@skill_window.refresh
else
$game_temp.seperation = false
$game_temp.limitbreak_skills = false
@skill_window.refresh
end
@skill_window.z = 1000
# Associate help window
@skill_window.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
end
end#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# StormTronics CMS by Blizzard
# Version: 5.38b - Hybrid Edition
# Type: Enhanced Custom Menu System
# Date v5.0: 27.8.2007
# Date v5.0b: 12.9.2007
# Date v5.1b: 28.1.2008
# Date v5.2b: 29.1.2008
# Date v5.3b: 23.7.2008
# Date v5.31b: 20.8.2008
# Date v5.32b: 21.8.2008
# Date v5.33b: 15.11.2008
# Date v5.34b: 8.4.2009
# Date v5.35b: 9.4.2009
# Date v5.36b: 6.5.2009
# Date v5.37b: 20.5.2009
# Date v5.38b: 31.5.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
# 97% compatible with SDK v1.x. 80% compatible with SDK v2.x. Glitchs with
# Fukuyama's Caterpillar script (but not with mine). Designed only for 8
# elements. WILL corrupt old savegames.
#
#
# Features:
#
# - completely animated and graphically optimized (lag-free)
# - own set of windowskins, fonts and icons for every status change and
# element
# - saves all changed options together with the savefile
# - menu commands "Item", "Equipment", "Skill", "Equip", "Status", "Options",
# "Save", "Load", "Exit"
# - Item submenu: "Items", "Sort" (by quantity or by alphabet), "Quest Items"
# - Equipment submenu shows information about equippable items for the chosen
# character, switch the character with LEFT and RIGHT
# - Skill submenu shows available skills for use for the chosen character,
# switch character with L and R, menu status window in background shows the
# chosen character
# - Equip submenu shows complete information about Status resistance/attack,
# Element resistance/attack and complete character stat changing (has
# even "max HP" and "max SP" available if you are using "Weapon/Armor HP/SP
# Plus")
# - Status screen with overall information about character status
# - Options submenu with "BGM Volume", "SFX Volume", "Battle BGM",
# "Battle Cam" (if using KGC's Pseudo 3D Battle Camera with my add-on for
# disabling), "Bar Style", "Bar Opacity" (if you are using Gradient Bar
# Styler), "Font" and "Windowskin" (both with preview)
# - Standard Save, Load and Exit commands
# - uses "Ultimate Font Override", so the font changes will affect RPG Maker
# XP versions 1.00, 1.01, 1.02 and 1.03 (including Dyna Edition and
# Postality Knights Edition Enhanced) and the font even gets saved with the
# savedata
#
# new in Hybrid Edition:
# - supports either windowskin background or custom images:
# >>> All StormTronics CMS Editions in one! <<<
# - compatible with all my scripts (even DREAM v4.0)
# - draws SR in the menu if CLRS was detected
# - supports any number of party members
# - removed some special add-ons, please get Tons of Add-ons if you want to
# continue using them, ST CMS will recognize Tons v4.98b and higher
# - more than 1500 code lines less than Nemesis Edition and almost 2000
# code lines less than Metal-Plate Edition
# - removes options from Options menu that are not / cannot being used at all
# - possibility to use a different equip system
# - doesn't need skin icons anymore, the icon is drawn from the skin directly
# - improved windowskins from "The Legend of Leximaâ„¢ IV - Chaos Project"
#
#
# Instructions:
#
# Copy your character faces into a the folder called "Characters". The
# facesets MUST have the same names as the character spritesets with a _face
# added at the end. Also copy the windowskins and the icons. Don't forget to
# include the font files used by the game in your game folder. Also change
# the variable ID in the conditional branches if you use another variable
# than 49.
#
#
# Configuration:
#
# CAM_AVAILABLE - set to true if you use KGC 3DPBC
# FACESETS - set to true if you want to use facesets
# BGM_Variable - ID number of the variable for the Battle BGM
# changer
# BGM_Lock - ID number of the switch used to temporarily
# disable the option of changing the Battle BGM, for
# that, just turn the switch on and off to disable
# and enable this option
# WEAPONS_AND_ARMORS - set to false to not show weapons and armors in the
# Item screen
# QUEST_ITEMS - add any item IDs that are supposed to be quest
# items, so the CMS can separate them
# BATTLE_BGMS - add any battle BGMs you are using
# CMS_SKINS - add any skin name you are using
# CMS_FONTS - add any font name you are using, be sure to
# include the font install files in your game
# release as some people may not have those fonts
# installed
# SAVE_NAME - name of your savefiles (usually "Save")
# SAVE_EXTENSION - extension of your savefiles (usually "rxdata")
# SAVE_FILES_NUMBER - number of savefiles you are using (usually 4)
# MAP_BACKGROUND - set to true to show map as background, otherwise
# if BlizzCFG::CMS_EDITION is not nil or false the
# "CMSFullscreen" image will be displayed
# CUSTOM_ITEM_SCENE - set this to true if you want to use a different
# equip scene and make this CMS compatible even with
# exotic Item Systems
# CUSTOM_EQUIPMENT_SCENE - set this to true if you want to use a different
# equip scene and make this CMS compatible even with
# exotic Equipment Systems, change only if you have
# another Equipment Scene script ready
# CUSTOM_EQUIP_SCENE - set this to true if you want to use a different
# equip scene and make this CMS compatible even with
# exotic Equipment Systems
# CUSTOM_SKILL_SCENE - set this to true if you want to use a different
# skill scene and make this CMS compatible even with
# exotic Skill Systems
# CUSTOM_STATUS_SCENE - set this to true if you want to use a different
# status scene
# CUSTOM_OPTIONS_SCENE - set this to true if you want to use a different
# options scene, change only if you have another
# Options Scene script ready
# CUSTOM_END_SCENE - set this to true if you want to use a different
# end scene
# FONT_BACKGROUND_FIX - set this to true if you want dark font colors to
# be used in the menu, this comes in handy when the
# custom background images you use are bright
# WIN_MIRRORED - flips horizontally all window positions
# CMS_EDITION - set this to false or nil if you want to use
# Nemesis Edition, set to folder name where in the
# Pictures/CMS the images should be loaded from if
# you want to use custom images as background
#
# The syntax $game_system.get_cam can be used by an event (Call script
# command) to restore the user's setting of the KGC 3DPBC if a forced cam
# control was initiated during an event.
#
# You can use $game_system.reset_battle_bgm to reset the battle BGM to the
# player's menu setting if you have changed it for i.e. a boss fight via
# event.
#
#
# FAQ:
#
# - Problem:
# I get an error that some icons can't be found. how do I solve this?
#
# - Solution:
# Copy the icons from the demo or download them and place the into the Icons
# folder into another folder called "CMS". Done.
#
# - Problem:
# I still get an error.
#
# - Solution:
# Rename the icons. If your elements were renamed and don't have the standard
# names, your icons need to be renamed as well. Same goes for status effects.
# Also be sure to add new icons with new names if you have more than the
# basic 8 elements and/or more than the basic 16 status effects in your
# database.
#
# - Question:
# Can I use my own skins, icons, fonts, battle BGMs, etc...?
#
# - Answer:
# Of course. Only be sure to change the appropriate options in the script and
# to use the appropriate names, so everything can function normally after
# that.
#
# - Question:
# Can this CMS be connected with other scripts? If yes, how and how much work
# is it?
#
# - Answer:
# Yes, it can. A little bit of scripting and enhancing the functions of the
# CMS are needed if it is going to be connected with other scripts. How much
# of additional work it can cause only depends how big the script merge is. A
# simple changing of the battle menu to display status effects in icons
# should take between 15~30 minutes of scripting and testing. Adding another
# option into the Options menu should also take only 15~30 minutes of
# scripting and testing. Even adding an entire series of new windows or
# implementing another Scene into the menu also won't take more than 30
# minutes, because the menu itself works with the "sub-scene" system, saving
# this way RAM and CPU.
#
# - Question:
# What is the "sub-scene" system? Also I have tried other animated CMS-es.
# Why is this one so lag-free?
#
# - Answer:
# It is lag-free just because of the "sub-scene" system. This system is also
# used in the "Scene_Battle". It only creates windows and handels them when
# they are needed or used, otherwise they get disposed or not created at all.
# In this script this method is being used to a possible maximum.
#
# - Question:
# Is this for real? This CMS doesn't even have 3000 lines of code!
#
# - Answer:
# Actually not even 2500 if you don't count the instructions.
#
# - Question:
# How is such a large collection of features possible with so relatively few
# lines of code?!
#
# - Answer:
# Smart coding. =P
#
#
# Additional scripts/snipplets/add-ons:
#
# - Ultimate Font Override v1.0b (by Blizzard)
# - BGM/SFX Volume Control with volume correction v1.0b (by Blizzard)
# - Map Name/Location v1.0b (by Blizzard)
# - Elemental Vulnerability Graph v1.0b (by Blizzard)
# - Battle BGM control v2.0b (by Blizzard)
# - Options control layout and funcionality v4.0b (by Blizzard)
# - CMS layout/funcionality v5.0b (by Blizzard)
# - optimized code and delagged by "sub-scene" window handling (by Blizzard)
#
# If you experience the "Stack level too deep" error, you may already have
# one of the scripts listed above and it conflicts with itself, because of
# aliased recursive calling. Try removing script by script and testing
# everything. Don't forget to backup you Scripts.rxdata before doing so.
# Scripts.rxdata is a file that contains your current scripts and is located
# in the Data folder of your game folder.
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# basic config
CAM_AVAILABLE = false
FACESETS = false
BGM_Variable = 49
BGM_Lock = 49
WEAPONS_AND_ARMORS = true
QUEST_ITEMS = [23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
# custom game configs
BATTLE_BGMS = [
# ['BGM_NAME', VOLUME, PITCH, 'DISPLAY_NAME']
['001-Battle01', 100, 100, 'BGM 1'],
['002-Battle02', 100, 100, 'BGM 2'],
['003-Battle03', 100, 100, 'BGM 3'],
['004-Battle04', 100, 100, 'BGM 4']]
CMS_SKINS = ['Original', 'Heavy Gold', 'Hell Breath', 'Liquid Water',
'Violent Violet', 'Ice Cool', 'Fatal Venom', 'Perfect Chaos',
'Blizzard Master']
CMS_FONTS = ['Arial', 'Future', 'Comic Sans MS', 'Brush Script', 'Tahoma',
'Times New Roman']
# save file options
SAVE_NAME = 'Save'
SAVE_EXTENSION = 'rxdata'
SAVE_FILES_NUMBER = 4
# extra options
MAP_BACKGROUND = true
CUSTOM_ITEM_SCENE = false
CUSTOM_EQUIPMENT_SCENE = false
CUSTOM_EQUIP_SCENE = false
CUSTOM_SKILL_SCENE = false
CUSTOM_STATUS_SCENE = false
CUSTOM_OPTIONS_SCENE = false
CUSTOM_END_SCENE = false
FONT_BACKGROUND_FIX = false
WIN_MIRRORED = false
CMS_EDITION = false # 'Metal-Plate'
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# change only if changed in the 3DPBC script
CAM_Variable = 25 if CAM_AVAILABLE
end
# for compatibility
$stormtronics_cms = 5.38
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_accessor :bgm_volume
attr_accessor :sfx_volume
attr_accessor :cam
attr_reader :fontname
attr_reader :fontsize
alias init_storm_cms_later initialize
def initialize
init_storm_cms_later
@bgm_volume = @sfx_volume = 100
@cam = 0
if $tons_version != nil
if $tons_version >= 6.03 && !@BARS
@bar_style, @bar_opacity = 0, 255
end
if $tons_version < 1.6
self.fontname = 'Arial'
self.fontsize = 22
end
else
self.fontname = 'Arial'
self.fontsize = 22
end
end
def fontname=(name)
Font.default_name = $defaultfonttype = $fontface = @fontname = name
end
def fontsize=(size)
Font.default_size = $defaultfontsize = $fontsize = @fontsize = size
end
def get_cam
$game_variables[BlizzCFG::CAM_Variable] = @cam
return true
end
def reset_battle_bgm
bgm = BlizzCFG::BATTLE_BGMS[$game_variables[BlizzCFG::BGM_Variable]]
$game_system.battle_bgm = RPG::AudioFile.new(bgm[0], bgm[1], bgm[2])
return true
end
if $dream_music
def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil && bgm.name != ''
vol = correction(@bgm_volume)
dream_ed = bgm.clone
dream_ed.volume = dream_ed.volume * vol / 100
DREAM.play_encrypted_audio('Audio/BGM/', dream_ed, 0)
else
Audio.bgm_stop
end
Graphics.frame_reset
end
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil && bgs.name != ''
vol = correction(@sfx_volume)
dream_ed = bgs.clone
dream_ed.volume = dream_ed.volume * vol / 100
DREAM.play_encrypted_audio('Audio/BGS/', dream_ed, 1)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
def me_play(me)
if me != nil && me.name != ''
vol = correction(@bgm_volume)
dream_ed = me.clone
dream_ed.volume = dream_ed.volume * vol / 100
DREAM.play_encrypted_audio('Audio/ME/', dream_ed, 2)
else
Audio.me_stop
end
Graphics.frame_reset
end
def se_play(se)
if se != nil && se.name != ''
vol = correction(@sfx_volume)
dream_ed = se.clone
dream_ed.volume = dream_ed.volume * vol / 100
DREAM.play_encrypted_audio('Audio/SE/', dream_ed, 3)
end
end
else
def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil && bgm.name != ''
vol = correction(@bgm_volume)
Audio.bgm_play('Audio/BGM/' + bgm.name , bgm.volume * vol / 100, bgm.pitch)
else
Audio.bgm_stop
end
Graphics.frame_reset
end
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil && bgs.name != ''
vol = correction(@sfx_volume)
Audio.bgs_play('Audio/BGS/' + bgs.name, bgs.volume * vol / 100, bgs.pitch)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
def me_play(me)
if me != nil && me.name != ''
vol = correction(@bgm_volume)
Audio.me_play('Audio/ME/' + me.name, me.volume * vol / 100, me.pitch)
else
Audio.me_stop
end
Graphics.frame_reset
end
def se_play(se)
if se != nil && se.name != ''
vol = correction(@sfx_volume)
Audio.se_play('Audio/SE/' + se.name, se.volume * vol / 100, se.pitch)
end
end
end
def correction(volume)
case volume
when 100 then return 100
when 95 then return 97
when 90 then return 95
when 85 then return 92
when 80 then return 90
when 75 then return 87
when 70 then return 85
when 65 then return 82
when 60 then return 80
when 55 then return 77
when 50 then return 75
when 45 then return 72
when 40 then return 70
when 35 then return 65
when 30 then return 60
when 25 then return 55
when 20 then return 50
when 15 then return 40
when 10 then return 35
when 5 then return 25
end
return 0
end
end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
def now_exp
return (@exp-@exp_list[@level])
end
def next_exp
return (@exp_list[@level+1] > 0 ? @exp_list[@level+1]-@exp_list[@level] : 0)
end
def test_equip(equip_type, id)
case equip_type
when 0 then old_id, @weapon_id = @weapon_id, id
when 1 then old_id, @armor1_id = @armor1_id, id
when 2 then old_id, @armor2_id = @armor2_id, id
when 3 then old_id, @armor3_id = @armor3_id, id
when 4 then old_id, @armor4_id = @armor4_id, id
end
tested = [self.maxhp, self.maxsp, self.atk, self.pdef, self.mdef, self.str,
self.dex, self.agi, self.int, self.eva]
case equip_type
when 0 then @weapon_id = old_id
when 1 then @armor1_id = old_id
when 2 then @armor2_id = old_id
when 3 then @armor3_id = old_id
when 4 then @armor4_id = old_id
end
return tested
end
end
#==============================================================================
# Scene_Title
#==============================================================================
class Scene_Title
alias main_storm_cms_later main
def main
$map_infos = load_data('Data/MapInfos.rxdata')
$map_infos.keys.each {|key| $map_infos[key] = $map_infos[key].name}
main_storm_cms_later
end
end
#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
def name
return $map_infos[@map_id]
end
end
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap
if $tons_version == nil || $tons_version < 3.71
alias init_ultimate_font_override_later initialize
def initialize(w, h = nil)
if w.is_a?(Numeric) && h.is_a?(Numeric)
init_ultimate_font_override_later(w, h)
else
init_ultimate_font_override_later(w)
end
if $game_system != nil && $game_system.fontname != nil &&
!$scene.is_a?(Scene_Title)
self.font.name = $game_system.fontname
self.font.size = $game_system.fontsize
else
self.font.name = Font.default_name
self.font.size = Font.default_size
end
end
def gradient_bar(x, y, w, color1, color2, color3, rate, flag = false)
offset = 5
x += offset
y += 26
(0...offset+3).each {|i| fill_rect(x-i, y+i-2, w+3, 1, Color.new(0, 0, 0))}
(0...offset+1).each {|i| fill_rect(x-i, y+i-1, w+1, 1, Color.new(255, 255, 255))}
(0...w+offset).each {|i|
red = color3.red * i / (w + offset)
green = color3.green * i / (w + offset)
blue = color3.blue * i / (w + offset)
oy = i < offset ? offset-i : 0
off = i < offset ? i : i > w ? w+offset-i : offset
fill_rect(x+i-offset+1, y+oy-1, 1, off, Color.new(red, green, blue))}
if (w*rate).to_i >= offset
(0...(w*rate).to_i+offset).each {|i|
red = color1.red + (color2.red-color1.red)*i/((w+offset)*rate)
green = color1.green + (color2.green-color1.green)*i/((w+offset)*rate)
blue = color1.blue + (color2.blue-color1.blue)*i/((w+offset)*rate)
oy = i < offset ? offset-i : 0
off = i < offset ? i : i > w*rate ? (w*rate).to_i+offset-i : offset
fill_rect(x+i-offset+1, y+oy-1, 1, off, Color.new(red, green, blue))}
else
(0...(w*rate).to_i).each {|i| (0...offset-1).each {|j|
red = color1.red + (color2.red-color1.red) * i / (w * rate)
green = color1.green + (color2.green-color1.green) * i / (w * rate)
blue = color1.blue + (color2.blue-color1.blue) * i / (w * rate)
set_pixel(x+i-j+1, y+j-1, Color.new(red, green, blue))}}
end
end
end
def draw_element_graph(x_plus, y_plus, rad, color, limit = -1)
(-rad-1...0).each {|r| (r...0).each {|x|
color.alpha = 255 * (rad+1.0-r.abs)/(rad+1)
y = (r.abs * Math.sin(Math.acos(x/r.to_f))).to_i
h = y * 2
case limit
when 1, 8 then h = (y < x.abs ? 0 : y - x.abs)
when 2, 7 then y > x.abs ? h = y = x.abs : h = y
when 3, 6
y > x.abs ? h = y = x.abs : h = y
y = 0 if y > 0
when 4, 5 then h, y = (y < x.abs ? 0 : y - x.abs), -x.abs
end
if limit < 5
fill_rect(rad*2-x + x_plus, rad-y + y_plus, 1, h, color)
else
fill_rect(rad*2+x+1 + x_plus, rad-y + y_plus, 1, h, color)
end}}
end
end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
alias st_cms_hybrid_hack_init initialize
def initialize(xx, yy, w, h)
st_cms_hybrid_hack_init(xx, yy, w, h)
if BlizzCFG::CMS_EDITION && @background != nil
@backsprite = Sprite.new
@backsprite.bitmap = RPG::Cache.picture("CMS/#{BlizzCFG::CMS_EDITION}/#{@background}")
self.opacity, @backsprite.x, @backsprite.y = 0, self.x, self.y
end
end
alias st_cms_hybrid_hack_x_ x=
def x=(xx)
st_cms_hybrid_hack_x_($scene.is_a?(Scene_Menu) && BlizzCFG::WIN_MIRRORED ? 640-width-xx : xx)
@backsprite.x = xx unless @backsprite == nil || @backsprite.disposed?
end
alias st_cms_hybrid_hack_y_ y=
def y=(yy)
st_cms_hybrid_hack_y_(yy)
@backsprite.y = yy unless @backsprite == nil || @backsprite.disposed?
end
alias st_cms_hybrid_hack_x x
def x
xx = st_cms_hybrid_hack_x
return ($scene.is_a?(Scene_Menu) && BlizzCFG::WIN_MIRRORED ? 640-width-xx : xx)
end
alias st_cms_hybrid_hack_z z=
def z=(z)
st_cms_hybrid_hack_z(z)
@backsprite.z = z unless @backsprite == nil || @backsprite.disposed?
end
alias st_cms_hybrid_hack_width width=
def width=(w)
self.x += w-width if $scene.is_a?(Scene_Menu) && BlizzCFG::WIN_MIRRORED
st_cms_hybrid_hack_width(w)
end
alias st_cms_hybrid_hack_visible visible=
def visible=(expr)
st_cms_hybrid_hack_visible(expr)
@backsprite.visible = expr unless @backsprite == nil || @backsprite.disposed?
end
alias disp_sprite_later dispose
def dispose
@backsprite.dispose unless @backsprite == nil || @backsprite.disposed?
disp_sprite_later
end
alias st_cms_hybrid_hack_normal_color normal_color
def normal_color
if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
return Color.new(0, 0, 0)
else
return st_cms_hybrid_hack_normal_color
end
end
alias st_cms_hybrid_hack_system_color system_color
def system_color
if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
return Color.new(160, 0, 255)
else
return st_cms_hybrid_hack_system_color
end
end
alias st_cms_hybrid_hack_disabled_color disabled_color
def disabled_color
if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
return Color.new(96, 96, 96)
else
return st_cms_hybrid_hack_disabled_color
end
end
alias st_cms_hybrid_hack_crisis_color crisis_color
def crisis_color
if $scene.is_a?(Scene_Menu) && BlizzCFG::FONT_BACKGROUND_FIX
return Color.new(192, 192, 0)
else
return st_cms_hybrid_hack_crisis_color
end
end
alias draw_actor_graphic_st_cms_later draw_actor_graphic
def draw_actor_graphic(actor, x, y)
if actor != nil && actor.character_name != ''
if self.is_a?(Window_CMSMenuStatus) && BlizzCFG::FACESETS
bitmap = RPG::Cache.character("#{actor.character_name}_face", actor.character_hue)
x -= bitmap.width / 2
y -= bitmap.height
draw_actor_face_st_cms(actor, x, y)
else
draw_actor_graphic_st_cms_later(actor, x, y)
end
end
end
def draw_actor_face_st_cms(actor, x, y)
if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
hue = 0
else
hue = (FACE_HUE ? actor.character_hue : 0)
end
bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(x, y, bitmap, src_rect)
end
def draw_actor_battler(actor, x, y)
if actor != nil && actor.battler_name != ''
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw,ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
end
def draw_actor_exp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 48, 32, 'EXP')
if actor.exp_s.to_i > 999999
w = self.contents.text_size('999999').width
else
w = self.contents.text_size(actor.exp_s).width
end
if actor.next_exp_s.to_i > 999999
w2 = self.contents.text_size('999999').width
else
w2 = self.contents.text_size(actor.next_exp_s).width
end
self.contents.font.color = normal_color
self.contents.draw_text(x + 108 - w2, y, w2, 32, actor.exp_s, 2)
self.contents.draw_text(x + 108, y, 12, 32, '/', 1)
self.contents.draw_text(x + 120, y, w2, 32, actor.next_exp_s)
end
def draw_actor_exp_alt(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 64, 32, 'next')
self.contents.font.color = normal_color
self.contents.draw_text(x + 56, y, 84, 32, actor.next_rest_exp_s, 2)
end
def draw_actor_name2(actor, x, y, w, a)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, w, 32, actor.name, a)
end
def up_color
return Color.new(0, 255, 0)
end
def down_color
return Color.new(255, 0, 0)
end
alias draw_actor_parameter_st_cms_later draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
if type == 7
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, 'Evasion')
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, actor.eva.to_s, 2)
else
draw_actor_parameter_st_cms_later(actor, x, y, type)
end
end
def draw_actor_element_vulnerability(actor, x, y, rad = 60)
colors = []
(1..8).each {|i|
rate = actor.element_rate(i)
if rate < 0
colors.push(Color.new(0, 255 * (100-rate.abs) / 200, 255))
elsif rate == 0
colors.push(Color.new(0, 128, 255))
elsif rate <= 50
colors.push(Color.new(0, 255 * (rate+50) / 100, 255 * (50-rate) / 50))
elsif rate <= 100
colors.push(Color.new(255 * (rate-50) / 50 , 255, 0))
elsif rate <= 200
colors.push(Color.new(255, 255 * (200-rate) / 100, 0))
else
colors.push(normal_color)
end}
(1..8).each {|i|
self.contents.draw_element_graph(x + 16, y + 32, rad, colors[i-1], i)}
save_color = self.contents.font.color.clone
(1..8).each {|i|
str1 = $data_system.elements[i]
str2 = "#{actor.element_rate(i)}%"
w1 = self.contents.text_size(str1).width
w2 = self.contents.text_size(str2).width
case i
when 1 then x2, y2, x3, y3 = x+152, y+20, x+168, y+4
when 2 then x2, y2, x3, y3 = x+176, y+56, x+192, y+40
when 3 then x2, y2, x3, y3 = x+176, y+92, x+192, y+108
when 4 then x2, y2, x3, y3 = x+152, y+128, x+168, y+144
when 5 then x2, y2, x3, y3 = x+120-w1, y+128, x+104-w2, y+144
when 6 then x2, y2, x3, y3 = x+96-w1, y+92, x+80-w2, y+108
when 7 then x2, y2, x3, y3 = x+96-w1, y+56, x+80-w2, y+40
when 8 then x2, y2, x3, y3 = x+120-w1, y+20, x+104-w2, y+4
end
self.contents.font.color = save_color
self.contents.draw_text(x2, y2, w1, 32, str1)
self.contents.font.color = colors[i-1]
self.contents.draw_text(x3, y3, w2, 32, str2)}
self.contents.font.color = save_color
end
if $Blizz_Art
alias draw_actor_exp_blizzart_later draw_actor_exp
def draw_actor_exp(actor, x, y, w = 148)
if $game_system.BARS
w -= 12
rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80, 192)
color2 = Color.new(60 * rate, 180, 240, 192)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
end
color3 = Color.new(80, 80, 80, 192)
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
end
draw_actor_exp_blizzart_later(actor, x, y)
end
alias draw_actor_exp_new2 draw_actor_exp_alt
def draw_actor_exp_alt(actor, x, y, w = 148)
w -= 12
rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80)
color2 = Color.new(60 * rate, 180, 240)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240)
end
color3 = Color.new(80, 80, 80, 192)
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
draw_actor_exp_new2(actor, x, y)
end
end
end
#==============================================================================
# Window_CMSCommand
#==============================================================================
class Window_CMSCommand < Window_Command
attr_reader :continue
def initialize(index, continue)
@background = 'CMSCommand'
commands = [$data_system.words.item, 'Equipment', $data_system.words.equip,
$data_system.words.skill, 'Status', ' Party Switcher', 'Limit Break', 'Options', 'Save', 'Load', 'Exit']
super(180, commands)
@continue, self.index, self.x, self.y, self.z = continue, index, 972, 0, 999
end
def draw_item(i, color)
self.contents.fill_rect(0, i*32, 148, 32, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon("CMS/commandmenu#{i}")
opacity = (color == normal_color ? 255 : 128)
self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = color
self.contents.draw_text(32, i*32, 100, 32, @commands[i])
end
end
#==============================================================================
# Window_CMSChooseItem
#==============================================================================
class Window_CMSChooseItem < Window_Selectable
def initialize
@background = 'CMSHelp'
super(0, -576, 640, 64)
@commands = ['Items', 'Sort', 'Quest Items']
@item_max = @column_max = @commands.size
self.contents = Bitmap.new(width - 32, 32)
refresh
self.active, self.z, self.index = true, 2900, 0
end
def refresh
self.contents.clear
(0...@item_max).each {|i| draw_item(i, normal_color)}
end
def draw_item(i, color)
self.contents.font.color = color
self.contents.fill_rect(8 + 212*i, 0, 164, 32, Color.new(0, 0, 0, 0))
self.contents.draw_text(8 + 212*i, 0, 164, 32, @commands[i], 1)
end
end
#==============================================================================
# Window_CMSOptions
#==============================================================================
class Window_CMSOptions < Window_Selectable
attr_accessor :current_font
attr_reader :current_skin
attr_reader :skin_name
attr_reader :font_name
def initialize
@background = 'CMSFullscreen'
super(0, 512, 640, 480)
@commands = ['BGM Volume', 'SFX Volume', 'Battle BGM']
@commands.push('Battle Cam') if BlizzCFG::CAM_AVAILABLE
@commands.push('Bar Style', 'Bar Opacity') if $Blizz_Art
@commands.push('Font', 'Windowskin')
get_skin_and_font
self.contents = Bitmap.new(width - 32, height - 32)
self.z, self.index = 2999, 0
@item_max = @commands.size
refresh
end
def get_option
return @commands[index]
end
def refresh
self.contents.clear
self.contents.font.name = $game_system.fontname
(0...@item_max).each {|i|
self.contents.font.color = normal_color
self.contents.fill_rect(24, 16 + i*36, 192, 32, Color.new(0, 0, 0, 0))
self.contents.draw_text(24, 16 + i*36, 192, 32, @commands[i])
draw_arrows(288, 4 + i*36)
case @commands[i]
when 'BGM Volume' then draw_volume(288, 4 + i*36)
when 'SFX Volume' then draw_volume(288, 4 + i*36, true)
when 'Battle BGM' then draw_battle_bgm(288, 4 + i*36)
when 'Battle Cam' then draw_battle_cam(288, 4 + i*36)
when 'Bar Style' then draw_style(288, 4 + i*36)
when 'Bar Opacity' then draw_opacity(288, 4 + i*36)
when 'Font' then draw_font(288, 4 + i*36)
when 'Windowskin' then draw_skin(288, 4 + i*36)
end}
end
def draw_arrows(x, y)
self.contents.draw_text(x - 32, y + 13, 32, 32, '<<')
self.contents.draw_text(x + 249, y + 13, 32, 32, '>>')
end
def draw_volume(x, y, mode = false, width = 224)
volume = (mode ? $game_system.sfx_volume.to_f : $game_system.bgm_volume.to_f)
vol = volume.to_f / 100
color1 = Color.new(20, 40, 80, 192)
color2 = Color.new(60, 120, 240, 192)
color3 = Color.new(0, 0, 80, 192)
old, $game_system.bar_opacity = $game_system.bar_opacity, 255 if $Blizz_Art
self.contents.gradient_bar(x, y, width, color1, color2, color3, vol, true)
$game_system.bar_opacity = old if $Blizz_Art
end
def draw_style(x, y, width = 224)
color1 = Color.new(80, 80, 0, 192)
color2 = Color.new(240, 240, 0, 192)
self.contents.gradient_bar(x + 32, y, width - 64, color1, color2, color1, 1, true)
end
def draw_battle_bgm(x, y, width = 224)
bgm = BlizzCFG::BATTLE_BGMS[$game_variables[BlizzCFG::BGM_Variable]][3]
if $game_switches[BlizzCFG::BGM_Lock] || BlizzCFG::BATTLE_BGMS.size <= 1
self.contents.font.color = Color.new(0, 0, 0, 255)
self.contents.draw_text(x+1, y + 13+1, 224, 32, bgm, 1)
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x, y + 13, 224, 32, bgm, 1)
end
def draw_battle_cam(x, y, width = 224)
cam = ($game_variables[BlizzCFG::CAM_Variable] == 0 ? 'ON' : 'OFF')
self.contents.draw_text(x, y + 13, 224, 32, cam, 1)
end
def draw_opacity(x, y, width = 224)
alpha = case $game_system.bar_opacity
when 0 then 'No Bar'
when 1..85 then 'Light'
when 86..170 then 'Medium'
when 171..254 then 'Hard'
when 255 then 'Full'
end
self.contents.draw_text(x, y + 13, 224, 32, alpha, 1)
end
def draw_font(x, y, width = 224)
@font_name = BlizzCFG::CMS_FONTS[@current_font]
self.contents.font.name = @font_name
self.contents.draw_text(x, y + 13, 224, 32, @font_name, 1)
self.contents.font.name = $game_system.fontname
end
def draw_skin(x, y, width = 224)
@skin_name = BlizzCFG::CMS_SKINS[self.current_skin]
self.contents.draw_text(x, y + 13, 224, 32, @skin_name, 1)
self.contents.fill_rect(x + 48, y +428, 128, 128, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.windowskin(@skin_name)
self.contents.blt(x + 50, y + 50, bitmap, Rect.new(2, 2, 124, 124))
self.contents.blt(x + 48, y + 48, bitmap, Rect.new(128, 0, 16, 16))
self.contents.blt(x + 160, y + 48, bitmap, Rect.new(176, 0, 16, 16))
self.contents.blt(x + 48, y + 160, bitmap, Rect.new(128, 48, 16, 16))
self.contents.blt(x + 160, y + 160, bitmap, Rect.new(176, 48, 16, 16))
(2..4).each {|i|
self.contents.blt(x+i*32, y+48, bitmap, Rect.new(144, 0, 32, 16))}
(2..4).each {|i|
self.contents.blt(x+i*32, y+160, bitmap, Rect.new(144, 48, 32, 16))}
(2..4).each {|i|
self.contents.blt(x+48, y+i*32, bitmap, Rect.new(128, 16, 16, 32))}
(2..4).each {|i|
self.contents.blt(x+160, y+i*32, bitmap, Rect.new(176, 16, 16, 32))}
end
def current_skin
return (@current_skin == nil ? 0 : @current_skin)
end
def current_skin=(val)
@current_skin = (val.is_a?(Numeric) ? val : 0)
end
def get_skin_and_font
@font_name = $game_system.fontname
@current_font = BlizzCFG::CMS_FONTS.index(@font_name)
@skin_name = $game_system.windowskin_name
self.current_skin = BlizzCFG::CMS_SKINS.index(@skin_name)
end
def update_cursor_rect
if self.index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(16, @index*36 + 16, 128, 32)
end
end
end
#==============================================================================
# Window_CMSTarget
#==============================================================================
class Window_CMSTarget < Window_Base
attr_reader :index
attr_reader :actor
attr_reader :dir
def initialize(actor, mode = false)
@background = 'CMSTarget'
super(-304, 64, 256, 104)
self.contents = Bitmap.new(width - 32, height - 32)
@actor, @item_max = actor, 1
self.y += actor.index*104 unless mode
self.z = 3999
self.index = -1
refresh
end
def index=(i)
@index = i
update_cursor_rect
end
def refresh
self.contents.clear
draw_actor_name(@actor, 4, -4)
draw_actor_state(@actor, 100, -4, 112)
draw_actor_hp(@actor, 44, 16)
draw_actor_sp(@actor, 44, 38)
end
def update_actor(actor)
@actor = actor
refresh
end
def dir=(val)
self.y -= val*40
@dir = val
end
def update(i = @actor.index - 1)
unless self.index == -2
if @actor.index == i
self.index = 0 if self.index == -1
else
self.index = -1 if self.index == 0
end
end
self.y = 64+@actor.index*104 unless self.active
@dir = 0 if (self.y-64) / 104 * 104 == self.y-64
super()
update_cursor_rect
end
def update_cursor_rect
if !self.active || self.index == -1
self.cursor_rect.empty
elsif self.index >= 0
self.cursor_rect.set(0, @index * 96, 224, 72)
elsif self.index == -2
self.cursor_rect.set(0, 0, 224, 72)
end
end
end
#==============================================================================
# Window_Help
#==============================================================================
class Window_Help < Window_Base
alias init_storm_cms_later initialize
def initialize
@background = 'CMSHelp' if $scene.is_a?(Scene_Menu)
init_storm_cms_later
refresh
end
def refresh
self.contents.font.name = $game_system.fontname
end
end
#==============================================================================
# Window_CMSItem
#==============================================================================
class Window_CMSItem < Window_Selectable
def initialize
@background = 'CMSItem'
super(256, -512, 384, 416)
self.active, self.visible, self.z, self.index = false, false, 2999, -1
refresh
end
def data
return @data[self.index]
end
def draw_item(i)
number = case @data[i]
when RPG::Item then $game_party.item_number(@data[i].id)
when RPG::Weapon then $game_party.weapon_number(@data[i].id)
when RPG::Armor then $game_party.armor_number(@data[i].id)
end
if @data[i].is_a?(RPG::Item) && $game_party.item_can_use?(@data[i].id) ||
@mode == nil
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.fill_rect(4, i*32, 352, 32, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@data[i].icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(4, i*32 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(32, i*32, 212, 32, @data[i].name, 0)
self.contents.draw_text(308, i*32, 16, 32, ':', 1)
self.contents.draw_text(324, i*32, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(data == nil ? '' : data.description)
end
end
#==============================================================================
# Window_NormalItem
#==============================================================================
class Window_NormalItem < Window_CMSItem
attr_accessor :mode
def initialize
@mode = 0
super
self.visible = true
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
data1, data2, data3 = [], [], []
(1...$data_items.size).each {|i|
if $game_party.item_number(i) > 0 && !BlizzCFG::QUEST_ITEMS.include?(i)
data1.push($data_items[i])
end}
if BlizzCFG::WEAPONS_AND_ARMORS
(1...$data_weapons.size).each {|i|
data2.push($data_weapons[i]) if $game_party.weapon_number(i) > 0}
(1...$data_armors.size).each {|i|
data3.push($data_armors[i]) if $game_party.armor_number(i) > 0}
end
if [1, 2].include?(@mode)
data1.sort! {|a, b|
$game_party.item_number(a.id) <=> $game_party.item_number(b.id)}
data2.sort! {|a, b|
$game_party.weapon_number(a.id) <=> $game_party.weapon_number(b.id)}
data3.sort! {|a, b|
$game_party.armor_number(a.id) <=> $game_party.armor_number(b.id)}
[data1, data2, data3].each {|ary| ary.reverse!} if @mode == 2
elsif [3, 4].include?(@mode)
[data1, data2, data3].each {|ary| ary.sort! {|a, b| a.name <=> b.name}}
[data1, data2, data3].each {|ary| ary.reverse!} if @mode == 4
end
@data = data1 + data2 + data3
@item_max = @data.size
self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
(0...@item_max).each {|i| draw_item(i)}
end
end
#==============================================================================
# Window_QuestItem
#==============================================================================
class Window_QuestItem < Window_CMSItem
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
(1...$data_items.size).each {|i|
if $game_party.item_number(i) > 0 && BlizzCFG::QUEST_ITEMS.include?(i)
@data.push($data_items[i])
end}
@item_max = @data.size
self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
(0...@item_max).each {|i| draw_item(i)}
end
end
#==============================================================================
# Window_EquipmentItem
#==============================================================================
class Window_EquipmentItem < Window_CMSItem
attr_accessor :item_max
def initialize(actor)
@actor = actor
super()
self.x, self.y, self.z, self.index = 256, -548, 2999, 0
self.active = self.visible = true
end
def update_actor(actor)
@actor = actor
refresh
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
(1...$data_weapons.size).each {|i|
@data.push($data_weapons[i]) if $game_party.weapon_number(i) > 0}
(1...$data_armors.size).each {|i|
@data.push($data_armors[i]) if $game_party.armor_number(i) > 0}
@item_max = @data.size
self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
(0...@item_max).each {|i| draw_item(i)}
end
def draw_item(i)
case @data[i]
when RPG::Weapon
if @actor.equippable?($data_weapons[@data[i].id])
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
number = $game_party.weapon_number(@data[i].id)
when RPG::Armor
if @actor.equippable?($data_armors[@data[i].id])
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
number = $game_party.armor_number(@data[i].id)
end
self.contents.fill_rect(4, i*32, 352, 32, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@data[i].icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(32, i*32, 212, 32, @data[i].name, 0)
self.contents.draw_text(308, i*32, 16, 32, ':', 1)
self.contents.draw_text(324, i*32, 24, 32, number.to_s, 2)
end
end
#==============================================================================
# Window_CMSSkill
#==============================================================================
class Window_CMSSkill < Window_CMSItem
def initialize(actor)
@actor = actor
super()
self.x, self.y, self.z, self.index = -512, 64, 2999, 0
self.active = self.visible = true
end
def update_actor(actor)
@actor = actor
refresh
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
@actor.skills.each {|id| @data.push($data_skills[id])}
@item_max = @data.size
self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
(0...@item_max).each {|i| draw_item(i)}
end
def draw_item(i)
self.contents.fill_rect(4, i*32, 352, 32, Color.new(0, 0, 0, 0))
if @actor.skill_can_use?(@data[i].id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
bitmap = RPG::Cache.icon(@data[i].icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24), opacity)
text = @data[i].name
tons = ($tons_version != nil ? $tons_version : 0)
if tons >= 4.0 && TONS_OF_ADDONS::EQUAP_SKILLS && DISPLAY_AP_REQ
aps = $game_system.maxap(@data[i].id)
if aps > 0
text += " (#{@actor.ap(@data[i].id)}/#{aps})"
elsif DISPLAY_AP_ZERO
text += ' (0/0)'
end
end
self.contents.draw_text(32, i*32, 204, 32, text)
if @data[i].sp_cost > 0
sp_cost = @data[i].sp_cost
if tons >= 6.54 && $game_system.SP_COST_MOD
sp_cost = BlizzCFG.get_cost_mod(@actor.states, sp_cost)
end
self.contents.draw_text(292, i*32, 48, 32, sp_cost.to_s, 2)
end
end
end
#==============================================================================
# Window_CMSEquipLeft
#==============================================================================
class Window_CMSEquipLeft < Window_Base
attr_accessor :mode
attr_accessor :current
attr_accessor :changed
def initialize(actor)
@background = 'CMSEquipLeft'
super(640, 64, 288, 416)
self.contents = Bitmap.new(width - 32, height - 32)
@current = @changed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
@elements, @states, @actor, @mode, self.z = [], [], actor, 0, 2999
refresh
end
def update_actor(actor)
@actor = actor
refresh
end
def draw_actor_hp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 96, 32, "max #{$data_system.words.hp}")
self.contents.font.color = normal_color
self.contents.draw_text(x + 108, y, 48, 32, actor.maxhp.to_s, 2)
end
def draw_actor_sp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 96, 32, "max #{$data_system.words.sp}")
self.contents.font.color = normal_color
self.contents.draw_text(x + 108, y, 48, 32, actor.maxsp.to_s, 2)
end
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 180, 0)
draw_actor_hp(@actor, 4, 28)
draw_actor_sp(@actor, 4, 52)
(0..7).each {|i| draw_actor_parameter(@actor, 4, 76 + i*24, i)}
if @mode == 0
self.contents.font.color = up_color
self.contents.draw_text(4, 276, 200, 32, 'Elemental attack:')
self.contents.draw_text(4, 324, 200, 32, 'Status attack:')
elsif @mode == 1
self.contents.font.color = up_color
self.contents.draw_text(4, 276, 200, 32, 'Elemental resistance:')
self.contents.draw_text(4, 324, 200, 32, 'Status resistance:')
end
self.contents.font.color = normal_color
draw_elements(4, 300)
draw_states(4, 348)
@current.each_index {|i|
val = @current[i] - @changed[i]
if val != 0
self.contents.font.color = system_color
self.contents.draw_text(162, 28+i*24, 40, 32, '»»', 1)
self.contents.font.color = (val > 0 ? down_color : up_color)
self.contents.draw_text(204, 28+i*24, 48, 32, @changed[i].abs.to_s, 2)
end}
end
def set_new_parameters(elements, states)
@elements, @states = elements, states
refresh
end
def draw_elements(x, y)
@elements.each_index {|i|
icon = RPG::Cache.icon("CMS/elm_#{$data_system.elements[@elements[i]].downcase}")
self.contents.blt(x + i*28, y + 4, icon, Rect.new(0, 0, 24, 24))}
end
def draw_states(x, y)
@states.each_index {|i|
icon = RPG::Cache.icon("CMS/stat_#{$data_states[@states[i]].name.downcase}")
self.contents.blt(x + i*28, y + 4, icon, Rect.new(0, 0, 24, 24))}
end
end
#==============================================================================
# Window_CMSEquipRight
#==============================================================================
class Window_CMSEquipRight < Window_Selectable
def initialize(actor)
@background = 'CMSEquipRight'
super(928, 64, 352, 192)
self.contents = Bitmap.new(width - 32, height - 32)
@actor, self.active, self.z, self.index = actor, true, 2999, 0
refresh
end
def data
return @data[self.index]
end
def update_actor(actor)
@actor = actor
refresh
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, 120, 32, $data_system.words.weapon)
self.contents.draw_text(4, 32 * 1, 120, 32, $data_system.words.armor1)
self.contents.draw_text(4, 32 * 2, 120, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 120, 32, $data_system.words.armor3)
self.contents.draw_text(4, 32 * 4, 120, 32, $data_system.words.armor4)
(0...5).each {|i| draw_item_name(@data[i], 120, 32 * i)}
end
def update_help
@help_window.set_text(data == nil ? '' : data.description)
end
end
#==============================================================================
# Window_CMSEquipItem
#==============================================================================
class Window_CMSEquipItem < Window_Selectable
def initialize(actor, equip_type)
@background = 'CMSEquipItem'
super(928, 256, 352, 224)
self.active = self.visible = false
@actor, @equip_type, self.z, self.index = actor, equip_type, 3000, -1
refresh
end
def data
return @data[self.index]
end
def update_actor(actor, equip_type)
@actor = actor
@equip_type = equip_type
refresh
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
(1...$data_weapons.size).each {|i|
if $game_party.weapon_number(i) > 0 && weapon_set.include?(i)
@data.push($data_weapons[i])
end}
else
armor_set = $data_classes[@actor.class_id].armor_set
(1...$data_armors.size).each {|i|
if $game_party.armor_number(i) > 0 && armor_set.include?(i)
@data.push($data_armors[i]) if $data_armors[i].kind == @equip_type-1
end}
end
@data.push(nil)
@item_max = @data.size
self.contents = Bitmap.new(width - 32, @item_max * 32)
(0...@item_max-1).each {|i| draw_item(i)}
self.contents.font.color = system_color
self.contents.draw_text(4, (@item_max-1)*32, 100, 32, '[Unequip]')
end
def draw_item(i)
number = case @data[i]
when RPG::Weapon then $game_party.weapon_number(@data[i].id)
when RPG::Armor then $game_party.armor_number(@data[i].id)
end
self.contents.font.color = normal_color
bitmap = RPG::Cache.icon(@data[i].icon_name)
self.contents.blt(4, 4 + i*32, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(32, i*32, 212, 32, @data[i].name, 0)
self.contents.draw_text(212, i*32, 16, 32, ':', 1)
self.contents.draw_text(228, i*32, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(data == nil ? '' : data.description)
end
end
#==============================================================================
# Window_CMSStatus
#==============================================================================
class Window_CMSStatus < Window_Base
def initialize(actor)
@background = 'CMSFullscreen'
super(0, 512, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@actor, self.active, self.z = actor, true, 2999
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(224, 0, 120, 32, @actor.name, 1)
draw_actor_battler(@actor, 284, 232)
draw_actor_class(@actor, 400, 32)
draw_actor_level(@actor, 400, 0)
draw_actor_state(@actor, 400, 64, 168)
draw_actor_hp(@actor, 400, 92, 172)
draw_actor_sp(@actor, 400, 122, 172)
if $crls
if BlizzCFG::DRAW_SR_BAR
draw_actor_sr_with_bar(@actor, 400, 152, 172)
else
draw_actor_sr(@actor, 400, 152, 172)
end
draw_actor_exp(@actor, 400, 182, 172)
else
draw_actor_exp(@actor, 400, 152, 172)
end
(0..7).each {|i| draw_actor_parameter(@actor, 4, i*28, i)}
self.contents.font.color = system_color
w = self.contents.text_size('Elemental Vulnerability').width
self.contents.draw_text(365, 244, w, 32, 'Elemental Vulnerability')
self.contents.font.size -= 4
draw_actor_element_vulnerability(@actor, 320, 268)
self.contents.font.size += 4
self.contents.font.color = system_color
self.contents.draw_text(84, 244, 96, 32, 'Equipment')
self.contents.draw_text(4, 276, 96, 32, $data_system.words.weapon)
self.contents.draw_text(4, 308, 96, 32, $data_system.words.armor1)
self.contents.draw_text(4, 340, 96, 32, $data_system.words.armor2)
self.contents.draw_text(4, 372, 96, 32, $data_system.words.armor3)
self.contents.draw_text(4, 404, 96, 32, $data_system.words.armor4)
equips = [$data_weapons[@actor.weapon_id], $data_armors[@actor.armor1_id],
$data_armors[@actor.armor2_id], $data_armors[@actor.armor3_id],
$data_armors[@actor.armor4_id]]
equips.each_index {|i|
if @actor.equippable?(equips[i])
draw_item_name(equips[i], 108, 276 + i*32)
else
self.contents.font.color = (i == 0 ? knockout_color : crisis_color)
self.contents.draw_text(108, 276 + i*32, 192, 32, 'Nothing equipped')
end}
end
def update_actor(actor)
@actor = actor
refresh
end
end
#==============================================================================
# Window_CMSSortCommand
#==============================================================================
class Window_CMSSortCommand < Window_Command
def initialize
@background = 'CMSMini'
super(180, ['Standard', 'by quantity', 'by alphabet'])
self.x, self.y, self.z = 224, -128, 9999
end
end
#==============================================================================
# Window_CMSEndCommand
#==============================================================================
class Window_CMSEndCommand < Window_Command
def initialize
@background = 'CMSMini'
super(180, ['Back to game', 'Back to title', 'Exit game'])
self.x, self.y, self.z = 460, 524, 3999
end
end
#==============================================================================
# Window_CMSInfo
#==============================================================================
class Window_CMSInfo < Window_Base
def initialize
@background = 'CMSInfo'
super(0, 0, 180, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.active, self.x, self.y, self.z = false, 460, 896, 1999
refresh
end
def refresh
self.contents.clear
self.contents.font.name = $game_system.fontname
@double_sec = Graphics.frame_count * 2 / Graphics.frame_rate
total_sec = @double_sec / 2
hour, min, sec = total_sec / 60 / 60, total_sec / 60 % 60, total_sec % 60
if @double_sec % 2 == 1
text = sprintf('%02d %02d %02d', hour, min, sec)
else
text = sprintf('%02d:%02d:%02d', hour, min, sec)
end
self.contents.font.color = system_color
self.contents.font.size = 21
cx = contents.text_size($data_system.words.gold).width
self.contents.draw_text(148-cx, 10, cx, 32, $data_system.words.gold, 2) #148
self.contents.draw_text(0, 25, 148, 32, 'Location:')
self.contents.font.color = normal_color
self.contents.draw_text(-32, -9, 148, 32, text, 1)
self.contents.draw_text(0, 10, 144-cx, 32, $game_party.gold.to_s, 2)
self.contents.draw_text(0, 39, 148, 32, $game_map.name, 2)
end
def update
super
refresh if Graphics.frame_count * 2 / Graphics.frame_rate != @double_sec
end
end
#==============================================================================
# Window_CMSMenuStatus
#==============================================================================
class Window_CMSMenuStatus < Window_Base
attr_reader :index
attr_reader :actor
attr_reader :dir
def initialize(actor)
@background = 'CMSMenuStatus'
super(0, 0, 460, 120)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
@dir = 0
refresh
self.active = false
self.index = -1
self.x, self.y, self.z = -512, @actor.index * 120, 999
end
def index=(i)
@index = i
update_cursor_rect
end
def refresh
self.contents.clear
self.contents.font.name = $game_system.fontname
self.contents.font.color = normal_color
draw_actor_graphic(@actor, 56, 80)
draw_actor_name2(@actor, 8, 0, 88, 1)
draw_actor_level(@actor, 104, 0)
draw_actor_state(@actor, 168, 0, 252)
draw_actor_hp(@actor, 104, 28)
draw_actor_sp(@actor, 272, 28)
draw_actor_exp_alt(@actor, 272, 56)
if $crls
if BlizzCFG::DRAW_SR_BAR
draw_actor_sr_with_bar(@actor, 104, 56)
else
draw_actor_sr(@actor, 104, 56)
end
end
end
def dir=(val)
self.y -= val*56
@dir = val
end
def update(i = @actor.index - 1)
if @actor.index == i
self.index = 0 if self.index == -1
else
self.index = -1 if self.index == 0
end
self.y = @actor.index*120 unless self.active
@dir = 0 if self.y / 120 * 120 == self.y
super()
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, 0, width - 32, height - 32)
end
end
end
#==============================================================================
# Scene_Menu
#==============================================================================
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
@actor_index = @target_index = -1
@viewport1 = Viewport.new(0, 0, 640, 480)
@moved = false
end
def main
if BlizzCFG::MAP_BACKGROUND
@spriteset = Spriteset_Map.new
elsif BlizzCFG::CMS_EDITION
@spriteset = Sprite.new
@spriteset.bitmap = RPG::Cache.picture("CMS/#{BlizzCFG::CMS_EDITION}/CMSFullscreen")
end
continue = ((1..BlizzCFG::SAVE_FILES_NUMBER).any? {|i|
FileTest.exist?("#{BlizzCFG::SAVE_NAME}#{i}.#{BlizzCFG::SAVE_EXTENSION}")})
@command_window = Window_CMSCommand.new(@menu_index, continue)
(0...5).each {|i| @command_window.disable_item(i)} if $game_party.actors.size == 0
@command_window.disable_item(8) if $game_system.save_disabled
@command_window.disable_item(9) unless @command_window.continue
@info_window = Window_CMSInfo.new
@status_windows, @target_windows = [], []
$game_party.actors.each {|actor|
@status_windows.push(Window_CMSMenuStatus.new(actor))}
@help_window = Window_Help.new
@help_window.x, @help_window.y, @help_window.z = 0, -368, 9999
Graphics.transition
loop do
Graphics.update
Input.update
update
break if @scene != nil || $scene != self
end
loop do
Graphics.update
(@status_windows + [@command_window, @info_window]).each {|win| win.update}
move_da_outro
break if @status_windows[0].x <= - 512
end
Graphics.freeze
(@status_windows + @target_windows + [@command_window, @info_window,
@help_window, @spriteset]).each {|obj| obj.dispose if obj != nil}
del_sort if @sort_window != nil
del_status if @playerstatus_window != nil
del_equip if @left_window != nil
del_skill if @skill_window != nil
del_end if @end_window != nil
del_items if @item_choose_window != nil
del_equipment if @equips_window != nil
del_options if @options_window != nil
if @scene.is_a?(Scene_Title)
Graphics.transition(25)
Graphics.freeze
end
$scene = @scene
end
def equip_refresh
if @item_window.active
item = @item_window.data
last_hp = @actor.hp
last_sp = @actor.sp
@left_window.current = [@actor.maxhp, @actor.maxsp, @actor.atk,
@actor.pdef, @actor.mdef, @actor.str, @actor.dex, @actor.agi,
@actor.int, @actor.eva]
@left_window.changed = @actor.test_equip(@right_window.index, item == nil ? 0 : item.id)
elements = (item.is_a?(RPG::Weapon) ? item.element_set :
(item.is_a?(RPG::Armor) ? item.guard_element_set : []))
states = (item.is_a?(RPG::Weapon) ? item.plus_state_set :
(item.is_a?(RPG::Armor) ? item.guard_state_set : []))
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(elements, states)
else
@left_window.current = @left_window.changed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
@left_window.set_new_parameters([], [])
end
end
def del_sort
@sort_window.dispose
@sort_window = nil
end
def del_status
@playerstatus_window.dispose
@playerstatus_window = nil
end
def del_equip
@left_window.dispose
@right_window.dispose
@item_windows.each {|win| win.dispose}
@left_window = @right_window = @item_window = @item_windows = nil
end
def del_skill
@skill_window.dispose
@skill_window = nil
end
def del_target
@target_windows.each {|win| win.dispose}
@target_windows = []
end
def del_end
@end_window.dispose
@end_window = nil
end
def del_items
@items_window1.dispose
@items_window1 = nil
@items_window2.dispose
@items_window2 = nil
@item_choose_window.dispose
@item_choose_window = nil
end
def del_equipment
@equips_window.dispose
@equips_window = nil
del_target
end
def del_options
@options_window.dispose
@options_window = nil
end
def update
@status_windows.each {|win| win.update(@actor_index)}
@target_windows.each {|win| win.update(@target_index)}
@info_window.update
unless @status_windows[0].x < 0 || @status_windows[0].dir != 0 ||
@target_windows[0] != nil && @target_windows[0].dir != 0
@command_window.update
[@help_window, @equips_window, @item_choose_window, @sort_window,
@skill_window, @left_window, @right_window, @playerstatus_window,
@options_window, @end_window].each {|win| win.update if win != nil}
end
move_da_main if @status_windows[0].x < 0
move_da_selection if @status_windows[0].dir != 0
move_da_targeting if @target_windows[0] != nil && @target_windows[0].dir != 0
move_da_status if @playerstatus_window != nil && @playerstatus_window.y > 0
move_da_equip if @left_window != nil && @left_window.x > 0
move_da_skill if @skill_window != nil && @skill_window.x < 256
move_da_target if @target_windows[0] != nil && @target_windows[0].x < 0
move_da_items if @item_choose_window != nil && @item_choose_window.y < 0
move_da_sort if @sort_window != nil && @sort_window.y < 64
move_da_equipment if @equips_window != nil && @equips_window.y < 64
move_da_options if @options_window != nil && @options_window.y > 0
move_da_end if @end_window != nil && @end_window.y > 336
if @moved
@moved = false
return
end
if @equips_window != nil
update_equipment
elsif @command_window.active
update_command
elsif @status_windows[0].active
update_status
elsif @item_choose_window != nil
if @item_choose_window.active
items_refresh
update_items_choose
elsif @sort_window != nil && @sort_window.active
update_sort
elsif @items_window1 != nil && @items_window1.active
@items_window1.update
update_item
elsif @items_window2 != nil && @items_window2.active
@items_window2.update
update_item
elsif @target_windows[0] != nil && @target_windows[0].active
update_item_target
end
elsif @skill_window != nil && @skill_window.active
update_skill
elsif @target_windows[0] != nil && @target_windows[0].active
update_skill_target
elsif @right_window != nil
if @right_window.active
update_right_equip
elsif @item_window != nil && @item_window.active
@item_window.update
update_eitem
end
elsif @playerstatus_window != nil && @playerstatus_window.active
update_playerstatus
elsif @options_window != nil && @options_window.active
update_options
elsif @end_window != nil
update_end
end
end
def move_windows(wins, border, mdiff, lead, xy, acc = false)
if acc
diff = [[((xy ? lead.x : lead.y)-border).abs, mdiff].min, 1].max
else
diff = [[((xy ? lead.x : lead.y)-border).abs/2, mdiff].min, 1].max
end
wins[0].each {|win| win.x += diff if win != nil}
wins[1].each {|win| win.x -= diff if win != nil}
wins[2].each {|win| win.y += diff if win != nil}
wins[3].each {|win| win.y -= diff if win != nil}
@moved = true
end
def move_da_main
lead = @status_windows[0]
x_plus = @status_windows
x_minus = [@command_window]
y_minus = [@info_window]
move_windows([x_plus, x_minus, [], y_minus], 0, 128, lead, true)
end
def move_da_outro
@flag = true
lead = @status_windows[0]
x_plus = [@command_window]
x_minus = @status_windows + @target_windows + [@skill_window, @help_window]
y_plus = [@info_window]
y_minus = [@item_choose_window, @items_window1, @items_window2, @help_window]
move_windows([x_plus, x_minus, y_plus, y_minus], 0, 128, lead, true, true)
end
def move_da_selection(lead = @status_windows[@actor_index])
if lead.dir == 1
move_windows([[], [], [], @status_windows], 360, 32, lead, false)
else
move_windows([[], [], @status_windows, []], 0, 32, lead, false)
end
end
def move_da_targeting(lead = @target_windows[@target_index])
if lead.dir == 1
move_windows([[], [], [], @target_windows], 376, 32, lead, false)
else
move_windows([[], [], @target_windows, []], 64, 32, lead, false)
end
end
def move_da_sort(win = @sort_window)
move_windows([[], [], [win], []], 64, 32, win, false)
end
def move_da_status(win = @playerstatus_window)
move_windows([[], [], [], [win]], 0, 64, win, false)
end
def move_da_equip(win = @left_window)
x_minus = [@left_window, @right_window, @help_window] + @item_windows
move_windows([[], x_minus, [], []], 0, 64, win, true)
end
def move_da_skill(win = @skill_window)
x_plus = [@skill_window, @help_window]
move_windows([x_plus, [], [], []], 256, 64, win, true)
end
def move_da_target(win = @target_windows[0])
move_windows([@target_windows, [], [], []], 0, 32, win, true)
end
def move_da_items(win = @item_choose_window)
y_plus = [@item_choose_window, @items_window1, @items_window2, @help_window]
move_windows([[], [], y_plus, []], 0, 64, win, false)
end
def move_da_equipment(win = @equips_window)
y_plus = [@equips_window, @help_window]
move_windows([[], [], y_plus, []], 64, 64, win, false)
end
def move_da_options(win = @options_window)
move_windows([[], [], [], [win]], 0, 64, win, false)
end
def move_da_end(win = @end_window)
move_windows([[], [], [], [win]], 336, 64, win, false)
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.actors.size == 0 && @command_window.index < 5
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_ITEM_SCENE
@scene = Scene_Item.new
else
@item_choose_window = Window_CMSChooseItem.new
@items_window1 = Window_NormalItem.new
@items_window2 = Window_QuestItem.new
@items_window1.help_window = @items_window2.help_window = @help_window
@command_window.active = false
@help_window.x, @help_window.y = 0, -576
@help_window.set_text('')
@help_window.visible = false
items_refresh
end
when 1..4
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_windows.each {|win| win.active = true}
@actor_index = 0
when 5 #opening party switcher
$game_system.se_play($data_system.decision_se)
@scene = Scene_PartySwitcher.new
when 6 #opening Limit Break
$game_system.se_play($data_system.decision_se)
@scene = Scene_LimitMenu.new
when 7
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_OPTIONS_SCENE
@scene = Scene_Options.new
else
@options_window = Window_CMSOptions.new
@command_window.active = false
end
when 8
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
@scene = Scene_CMSSave.new
Graphics.transition(0)
end
when 9
if @command_window.continue
$game_system.se_play($data_system.decision_se)
@scene = Scene_CMSLoad.new
Graphics.transition(0)
else
$game_system.se_play($data_system.buzzer_se)
end
when 10
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_END_SCENE
@scene = Scene_End.new
else
@command_window.active = false
@end_window = Window_CMSEndCommand.new
end
end
end
end
def update_status
@actor = $game_party.actors[@actor_index]
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@status_windows.each {|win| win.active, win.index = false, -1}
@actor_index = -1
@command_window.active = true
elsif Input.trigger?(Input::C)
case @command_window.index
when 1
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_EQUIPMENT_SCENE
@scene = Scene_Equipment.new(@actor_index)
else
@equips_window = Window_EquipmentItem.new(@actor)
@equips_window.help_window = @help_window
@target_windows.push(Window_CMSTarget.new(@actor, true))
@status_windows.each {|win| win.active = false}
@help_window.visible = true
@help_window.x, @help_window.y = 0, -612
end
when 2
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_EQUIP_SCENE
@scene = Scene_Equip.new(@actor_index)
else
@left_window = Window_CMSEquipLeft.new(@actor)
@right_window = Window_CMSEquipRight.new(@actor)
@right_window.help_window = @help_window
@item_windows = []
(0..4).each {|i| win = Window_CMSEquipItem.new(@actor, 4-i)
win.help_window = @help_window
@item_windows.unshift(win)}
@item_windows[0].visible = @help_window.visible = true
@help_window.x, @help_window.y = 640, 0
@status_windows.each {|win| win.active = false}
end
when 3
if @actor.restriction >= 2
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_SKILL_SCENE
@scene = Scene_Skill.new(@actor_index)
else
@skill_window = Window_CMSSkill.new(@actor)
@skill_window.help_window = @help_window
@help_window.visible = true
@help_window.x, @help_window.y = -768, 0
@status_windows.each {|win| win.active = false}
end
end
when 4
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_STATUS_SCENE
@scene = Scene_Status.new(@actor_index)
else
@playerstatus_window = Window_CMSStatus.new(@actor)
@status_windows.each {|win| win.active = false}
end
end
elsif Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@actor_index = (@actor_index+1) % $game_party.actors.size
if @status_windows[@actor_index].y < 0
@status_windows.each {|win| win.y += ($game_party.actors.size-4)*120}
elsif @status_windows[@actor_index].y >= 480
@status_windows.each {|win| win.dir = 1}
end
elsif Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size-1
@actor_index %= $game_party.actors.size
if @status_windows[@actor_index].y < 0
@status_windows.each {|win| win.dir = -1}
elsif @status_windows[@actor_index].y >= 480
@status_windows.each {|win| win.y -= ($game_party.actors.size-4)*120}
end
end
end
def update_items_choose
if Input.trigger?(Input::B)
del_items
$game_system.se_play($data_system.cancel_se)
@command_window.active, @help_window.x, @help_window.y = true, 0, -612
elsif Input.trigger?(Input::C)
items_refresh
@item_choose_window.active = false
$game_system.se_play($data_system.decision_se)
case @item_choose_window.index
when 0
@items_window1.active = @help_window.visible = true
@items_window1.index = 0
when 1 then @sort_window = Window_CMSSortCommand.new
when 2
@items_window2.active = @help_window.visible = true
@items_window2.index = 0
end
end
end
def update_sort
if Input.trigger?(Input::B)
del_sort
@item_choose_window.active = true
$game_system.se_play($data_system.cancel_se)
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@items_window1.mode = case @sort_window.index
when 0 then @sort_window.index
when 1 then @items_window1.mode == 1 ? 2 : 1
when 2 then @items_window1.mode == 3 ? 4 : 3
end
@items_window1.refresh
end
end
def items_refresh
index = @item_choose_window.index
@items_window1.visible = [0, 1].include?(index)
@items_window2.visible = (index == 2)
end
def update_equipment
if Input.trigger?(Input::B)
del_equipment
$game_system.se_play($data_system.cancel_se)
@actor_index = -1
@command_window.active = true
@help_window.visible = false
@help_window.x, @help_window.y = 0, -612
elsif Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
if Input.trigger?(Input::RIGHT)
@actor_index = (@actor_index+1) % $game_party.actors.size
elsif Input.trigger?(Input::LEFT)
@actor_index += $game_party.actors.size-1
@actor_index %= $game_party.actors.size
end
@target_windows[0].update_actor($game_party.actors[@actor_index])
@equips_window.update_actor($game_party.actors[@actor_index])
unless @equips_window.item_max > @equips_window.index
@equips_window.index = 0
end
end
end
def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@item_choose_window.active = true
@help_window.set_text('')
@items_window1.active = @items_window2.active = @help_window.visible = false
@items_window1.index = @items_window2.index = -1
elsif Input.trigger?(Input::C)
win = (@item_choose_window.index == 0 ? @items_window1 : @items_window2)
@item = win.data
unless @item.is_a?(RPG::Item) && $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_party.actors.each_index {|i|
@target_windows.push(Window_CMSTarget.new($game_party.actors[i]))}
@target_index = 0
$game_system.se_play($data_system.decision_se)
if @item.scope.between?(3, 6)
win.active = false
@target_windows.each {|win| win.active = true}
if [4, 6].include?(@item.scope)
@target_windows.each {|win| win.index = -2}
else
@target_windows[@target_index].index = 0
end
elsif @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
win.draw_item(win.index)
end
(@status_windows + @target_windows).each {|win| win.refresh}
@scene = Scene_Map.new
elsif @skill.scope == 7
$game_system.se_play($data_system.buzzer_se)
end
end
end
def update_item_target
if Input.trigger?(Input::B)
del_target
$game_system.se_play($data_system.cancel_se)
@target_index = -1
@items_window1.refresh unless $game_party.item_can_use?(@item.id)
@items_window1.active = true
elsif Input.trigger?(Input::C)
if $game_party.item_number(@item.id) == 0
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_windows[0].index == -2
used = false
$game_party.actors.each {|actor| used |= actor.item_effect(@item)}
elsif @target_index >= 0
used = $game_party.actors[@target_index].item_effect(@item)
end
if used
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@items_window1.draw_item(@items_window1.index)
end
(@status_windows + @target_windows).each {|win| win.refresh}
if $game_party.all_dead?
@scene = Scene_Gameover.new
elsif @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
@scene = Scene_Map.new
end
else
$game_system.se_play($data_system.buzzer_se)
end
else
update_target
end
end
def update_target
return if @target_windows[0] == nil || @target_windows[0].index == -2
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@target_index = (@target_index+1) % $game_party.actors.size
if @target_windows[@target_index].y < 64
@target_windows.each {|win| win.y += ($game_party.actors.size-4)*104}
elsif @target_windows[@target_index].y >= 480
@target_windows.each {|win| win.dir = 1}
end
elsif Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@target_index += $game_party.actors.size-1
@target_index %= $game_party.actors.size
if @target_windows[@target_index].y < 64
@target_windows.each {|win| win.dir = -1}
elsif @target_windows[@target_index].y >= 480
@target_windows.each {|win| win.y -= ($game_party.actors.size-4)*104}
end
end
end
def update_skill
if Input.trigger?(Input::B)
del_skill
$game_system.se_play($data_system.cancel_se)
@help_window.x, @help_window.y = 0, -768
@help_window.visible = false
@command_window.active = true
@actor_index = @target_index = -1
elsif Input.trigger?(Input::C)
@skill = @skill_window.data
if @skill == nil || !@actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_party.actors.each_index {|i|
@target_windows.push(Window_CMSTarget.new($game_party.actors[i]))}
@target_index = 0
$game_system.se_play($data_system.decision_se)
if @skill.scope.between?(3, 6)
@skill_window.active = false
@target_windows.each {|win| win.visible = win.active = true}
if [4, 6].include?(@skill.scope)
@target_windows.each {|win| win.index = -2}
else
@target_windows[@target_index].index = 0
end
elsif @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
(@status_windows + @target_windows).each {|win| win.refresh}
@skill_window.refresh
@scene = Scene_Map.new
elsif @skill.scope == 7
$game_system.se_play($data_system.buzzer_se)
end
elsif Input.trigger?(Input::R) || Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
if Input.trigger?(Input::R)
@actor_index = (@actor_index+1) % $game_party.actors.size
elsif Input.trigger?(Input::L)
@actor_index += $game_party.actors.size-1
@actor_index %= $game_party.actors.size
end
@actor = $game_party.actors[@actor_index]
@skill_window.update_actor(@actor)
@skill_window.index = 0
end
end
def update_skill_target
if Input.trigger?(Input::B)
del_target
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_index = -1
elsif Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_windows[0].index == -2
used = false
$game_party.actors.each {|actor| used |= actor.skill_effect(@actor, @skill)}
else
used = $game_party.actors[@target_index].skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
(@status_windows + @target_windows).each {|win| win.refresh}
@skill_window.refresh
if $game_party.all_dead?
@scene = Scene_Gameover.new
elsif @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
@scene = Scene_Map.new
end
else
$game_system.se_play($data_system.buzzer_se)
end
else
update_target
end
end
def update_right_equip
@item_windows.each_index {|i|
@item_windows[i].visible = (@right_window.index == i)}
@item_window = @item_windows[@right_window.index]
newmode = [@right_window.index, 1].min
if newmode != @left_window.mode
@left_window.mode = newmode
@left_window.refresh
end
if Input.trigger?(Input::B)
del_equip
$game_system.se_play($data_system.cancel_se)
@help_window.x, @help_window.y = 660, 0
@command_window.active = true
@actor_index = -1
elsif Input.trigger?(Input::C)
if @actor.equip_fix?(@right_window.index)
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
@right_window.active = false
@item_window.active, @item_window.index = true, 0
equip_refresh
end
elsif Input.trigger?(Input::R) || Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
if Input.trigger?(Input::R)
@actor_index = (@actor_index+1) % $game_party.actors.size
elsif Input.trigger?(Input::L)
@actor_index += $game_party.actors.size-1
@actor_index %= $game_party.actors.size
end
@actor = $game_party.actors[@actor_index]
@right_window.update_actor(@actor)
@left_window.update_actor(@actor)
@item_windows.each_index {|i| @item_windows[i].update_actor(@actor, i)}
end
end
def update_eitem
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@right_window.active = true
@item_window.active, @item_window.index = false, -1
equip_refresh
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.equip_se)
item = @item_window.data
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
@right_window.active = true
@item_window.active, @item_window.index = false, -1
@right_window.refresh
@item_window.refresh
(@item_windows + @status_windows).each {|win| win.refresh}
equip_refresh
elsif Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN) ||
Input.repeat?(Input::R) || Input.repeat?(Input::L)
equip_refresh
end
end
def update_playerstatus
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@actor_index = -1
del_status
elsif Input.trigger?(Input::R) || Input.trigger?(Input::RIGHT) ||
Input.trigger?(Input::L) || Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
if Input.trigger?(Input::R) || Input.trigger?(Input::RIGHT)
@actor_index = (@actor_index+1) % $game_party.actors.size
elsif Input.trigger?(Input::L) || Input.trigger?(Input::LEFT)
@actor_index += $game_party.actors.size-1
@actor_index %= $game_party.actors.size
end
@actor = $game_party.actors[@actor_index]
@playerstatus_window.update_actor(@actor)
end
end
def update_options
if Input.trigger?(Input::B)
del_options
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
return
end
case @options_window.get_option
when 'BGM Volume'
if Input.repeat?(Input::RIGHT)
$game_system.bgm_volume += 5
$game_system.bgm_volume = 100 if $game_system.bgm_volume > 100
$game_system.bgm_play($game_system.bgm_memorize)
@options_window.refresh
elsif Input.repeat?(Input::LEFT)
$game_system.bgm_volume -= 5
$game_system.bgm_volume = 0 if $game_system.bgm_volume < 0
$game_system.bgm_play($game_system.bgm_memorize)
@options_window.refresh
end
when 'SFX Volume'
if Input.repeat?(Input::RIGHT)
$game_system.sfx_volume += 5
if $game_system.sfx_volume > 100
$game_system.sfx_volume = 100
else
$game_system.se_play($data_system.cursor_se)
end
@options_window.refresh
elsif Input.repeat?(Input::LEFT)
$game_system.sfx_volume -= 5
$game_system.sfx_volume = 0 if $game_system.sfx_volume < 0
$game_system.se_play($data_system.cursor_se)
@options_window.refresh
end
when 'Battle BGM'
if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT) ||
Input.repeat?(Input::C)
if $game_switches[BlizzCFG::BGM_Lock] || BlizzCFG::BATTLE_BGMS.size <= 1
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
ind = $game_variables[BlizzCFG::BGM_Variable]
if Input.repeat?(Input::RIGHT) || Input.repeat?(Input::C)
ind = (ind+1) % BlizzCFG::BATTLE_BGMS.size
elsif Input.repeat?(Input::LEFT)
ind = (ind+BlizzCFG::BATTLE_BGMS.size-1) % BlizzCFG::BATTLE_BGMS.size
end
$game_variables[BlizzCFG::BGM_Variable] = ind
$game_system.reset_battle_bgm
@options_window.refresh
end
end
when 'Battle Cam'
if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT) ||
Input.repeat?(Input::C)
if BlizzCFG::CAM_AVAILABLE
$game_system.se_play($data_system.decision_se)
$game_system.cam = ($game_system.cam+1) % 2
$game_system.get_cam
@options_window.refresh
else
$game_system.se_play($data_system.buzzer_se)
end
end
when 'Bar Style'
if Input.repeat?(Input::RIGHT)
if $game_system.bar_opacity == 0
$game_system.se_play($data_system.buzzer_se)
else
$game_system.bar_style = ($game_system.bar_style + 1) % 7
$game_system.se_play($data_system.decision_se)
@options_window.refresh
@status_windows.each {|win| win.refresh}
end
elsif Input.repeat?(Input::LEFT)
if $game_system.bar_opacity == 0
$game_system.se_play($data_system.buzzer_se)
else
$game_system.bar_style = ($game_system.bar_style + 6) % 7
$game_system.se_play($data_system.decision_se)
@options_window.refresh
@status_windows.each {|win| win.refresh}
end
end
when 'Bar Opacity'
if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.decision_se)
$game_system.bar_opacity += (Input.repeat?(Input::RIGHT) ? 64 : -64)
@options_window.refresh
@status_windows.each {|win| win.refresh}
end
when 'Font'
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.decision_se)
@options_window.current_font += 1
@options_window.current_font %= BlizzCFG::CMS_FONTS.size
@options_window.refresh
elsif Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.decision_se)
@options_window.current_font += BlizzCFG::CMS_FONTS.size - 1
@options_window.current_font %= BlizzCFG::CMS_FONTS.size
@options_window.refresh
elsif Input.repeat?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_system.fontname = @options_window.font_name
@command_window.refresh
@info_window.refresh
@status_windows.each {|win| win.refresh}
@help_window.refresh
@options_window.refresh
(0...5).each {|i| @command_window.disable_item(i)} if $game_party.actors.size == 0
@command_window.disable_item(8) if $game_system.save_disabled
@command_window.disable_item(9) unless @command_window.continue
end
when 'Windowskin'
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.decision_se)
@options_window.current_skin += 1
@options_window.current_skin %= BlizzCFG::CMS_SKINS.size
@options_window.refresh
elsif Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.decision_se)
@options_window.current_skin += BlizzCFG::CMS_SKINS.size - 1
@options_window.current_skin %= BlizzCFG::CMS_SKINS.size
@options_window.refresh
elsif Input.repeat?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_system.windowskin_name = @options_window.skin_name
end
end
end
def update_end
if Input.trigger?(Input::B) || Input.trigger?(Input::C) &&
@end_window.index == 0
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
del_end
elsif Input.trigger?(Input::C)
Graphics.freeze
$game_system.se_play($data_system.decision_se)
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
@end_window.index == 1 ? @scene = Scene_Title.new : $scene = nil
del_end
end
end
end
#==============================================================================
# Scene_CMSSave
#==============================================================================
class Scene_CMSSave < Scene_Save
def on_cancel
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(8)
end
end
#==============================================================================
# Scene_CMSLoad
#==============================================================================
class Scene_CMSLoad < Scene_Load
def on_cancel
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(9)
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Easy Party Switcher by Blizzard
# Version 2.43b
# Type: Party Changing System
# Date: 21.05.2006
# Date v1.1: 25.05.2006
# Date v1.2b: 27.05.2006
# Date v1.5b: 3.11.2006
# Date v1.51b: 29.11.2006
# Date v1.52b: 6.12.2006
# Date v1.7b: 23.2.2007
# Date v1.8b: 30.4.2007
# Date v2.0b: 7.8.2007
# Date v2.1b: 24.8.2007
# Date v2.11b: 24.9.2007
# Date v2.3b: 26.1.2008
# Date v2.32b: 28.1.2008
# Date v2.4b: 29.1.2008
# Date v2.41b: 6.8.2008
# Date v2.42b: 14.10.2008
# Date v2.43b: 20.10.2008
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Special Thanks to:
#
# Zeriab for pointing out a few glitches and shortening the code in an
# earlier version. =D
#
#
# IMPORTANT NOTE:
#
# Be sure to set the MAX_PARTY to the maximum size of your party. There is
# already a preconfiguration of 4.
#
#
# Compatibility:
#
# 98% compatible with SDK v1.x. 90% compatible with SDK 2.x. Can cause
# incompatibility issued with other Party Change Systems. Can cause problems
# with CBS-es if you use the battle switch feature. WILL corrupt your old
# savegames.
#
#
# Features:
#
# - set party members for "not _available" (shown transparent in the reserve)
# - remove party members from the reserve list ("disabled_for_party")
# - set party members, who MUST be in the party (shown transparent in the
# current party, "must_be_in_party")
# - set up forced positions for party members
# - set up forced party size
# - option either to wipe the party (for multi-party use) or only remove
# every member (except 1) from the party.
# - easy to use and easy to switch party members
# - also supports small parties (2 or 3 members) and large parties (5 or
# more)
# - uses facesets optionally
#
# v1.5b:
# - better, shorter and more efficient code (less memory use, less CPU use)
# - fixed potential bugs
#
# v1.7b:
# - improved coding
# - facesets now optional
# - no extra bitmap files needed anymore
# - works now with Tons of Add-ons
#
# v1.8b:
# - added "forced position"
# - added "forced party size"
#
# v2.0b:
# - fixed the bug where you could empty the party... again...
# - fixed the bug that appeared when you pressed SHIFT
# - added option to allow an empty party
# - added "EXP for party members in reserve" option
# - made the forced_size for party work more convenient
# - improved coding
# - slightly decreased lag
#
# v2.1b:
# - fixed a bug
# - improved coding
# - rewritten conditions using classic syntax to avoid RGSS conditioning bug
# - now can serve as enhancement for CP Debug System
#
# v2.11b:
# - improved coding and performance
#
# v2.3b:
# - optional feature to call the Party Switcher during battle
#
# v2.32b:
# - fixed crash problem with SDK 2.x when using the BATTLE_SWITCH option
# - fixed SP display glitch when using BARS from Tons of Add-ons
#
# v2.4b:
# - now you can activate party order change only in the party switcher
# - add option for automatic party order change only in battle
#
# v2.41b:
# - fixed problem where you could put together a party where everybody is
# dead
#
# v2.42b:
# - added possibility to change the BATTLE_SWITCH setting during the game
#
# v2.43b:
# - fixed a problem with SDK 2.x
#
#
# How to use:
#
# To call this script, make a "Call script" command in an event.
#
# 1. Syntax: $scene = Scene_PartySwitcher.new
# No extra feature will be applied and you can switch the party as you
# wish.
#
# 2. Syntax: $scene = Scene_PartySwitcher.new(XXX)
# You can replace XXX for 1 to remove all party members except one (either
# one, who must be in the party or a random one), or replace XXX with 2,
# to cause a wipe party. Wiping a party will disable the of the current
# members and a NEW party of the remaining members must be formed. If you
# replace it with 3, the current party configuration will be stored for a
# later fast switch-back. If XXX is 10, all actors will be available for
# party switching no matter if the are "not_available" or
# "disabled_for_party". This feature if used by the CP Debug System. No
# faceset will be used in this case for a more convenient working.
#
# 3. Syntax: $scene = Scene_PartySwitcher.new(XXX, 1)
# You can use the XXX as described above or just set it to 0 to disable
# it. Also the "1" in the syntax will reset any disabled_for_party and is
# made to be used after multi-party use.
#
# 4. Syntax: $scene = Scene_PartySwitcher.new(XXX, YYY, ZZZ)
# You can replace ZZZ with 1 to replace the party with a stored one AND
# store the current or replace it with 2 to replace the party with a
# stored one, but without storing the current. USE THIS ONLY IF YOU ASSUME
# TO HAVE A STORED PARTY READY! You can simply test if there is a store
# party by putting this code into the conditional branch script:
#
# $game_system.stored_party != nil
#
# This syntax will not open the Party Switcher and it will override the
# commands XXX and YYY, so you can replace these with any number.
#
# 5. To activate/deactivate the option of order change only, simply use the
# event command "Call Script" with following syntax:
#
# $game_system.order_only = true/false
#
# If the setting is set to true, the switcher will allow only party order
# change. The same goes for battle change (if you are using the
# BATTLE_SWITCH option), but the syntax is different:
#
# $game_system.battle_order_only = true/false
#
# The BATTLE_SWITCH option can be changed during the game by using
# following syntax:
#
# $game_system.battle_switch = true/false
#
# This option is intially set to the same setting as BATTLE_SWITCH is.
#
# Character faces go into the "Characters" folder and they have the same name
# as the character spritesets have with _face added
#
# Example:
#
# sprite - Marlen.png
# face - Marlen_face.png
#
# Other syntaxes:
# $game_actors[ID].not_available = true/false
# $game_actors[ID].disabled_for_party = true/false
# $game_actors[ID].must_be_in_party = true/false
# $game_actors[ID].forced_position = nil/0/1/2/...
# OR
# $game_party.actors[POS].not_available = true/false
# $game_party.actors[POS].disabled_for_party = true/false
# $game_party.actors[POS].must_be_in_party = true/false
# $game_party.actors[POS].forced_position = nil/0/1/2/...
#
# ID - the actor's ID in the database
# POS - the actor's position in the party (STARTS FROM 0, not 1!)
#
# not_available
# - will disable the possibility of an already unlocked character to be in
# the current party
#
# disabled_for_party
# - will cause the character NOT to appear in the party switch screen at all
#
# must_be_in_party
# - will cause the character to be automatically moved into the current party
# and he also cannot be put in the reserve
#
# forced_position
# - will enforce the player to be at a specific position in the party, set
# this value to nil to disable this feature, use it in combination with
# must_be_in_party and $game_party.forced_size or you might experience
# bugs,
#
# $game_party.forced_size = nil/0/1/2/...
#
# Using this syntax will enforce a specific party size. The EPS won't exit
# until this size is filled up or there are no more in the reserve. EPS will
# automatically "correct" this number if there are not enough characters in
# the reserve to fill up a party of forced_size. Set this value to nil to
# disable the size requirement. Note that the actor DO NOT HAVE TO be set in
# normal order without any empty position like in version 1.x.
#
#
# Additional note:
#
# For your own sake, do not apply the attribute "must_be_in_party" to a
# character at the same time with "not_available" or "disabled_for_party" as
# this WILL disrupt your party and party switch system. Use "forced_position"
# together with "must_be_in_party" to avoid bugs. Be careful when using
# "forced_position" with "$game_party.forced_size". Add actors at the very
# end to be sure the player can't put others after them if the "forced_size"
# is smaller than the maximum party size.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#==============================================================================
# module BlizzCFG
#==============================================================================
module BlizzCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# how many party members do you use
MAX_PARTY = 4
# set to true to use facesets instead of spritesets
FACESETS = false
# allows a party with 0 members
ALLOW_EMPTY_PARTY = false
# allows switching the party in battle
BATTLE_SWITCH = false
# name of the call command in the party menu in battle
SWITCH_COMMAND = 'Switch'
# gives all other characters EXP (specify in %)
EXP_RESERVE = 50
# gives "not available" characters EXP (specify in %)
EXP_NOT_AVAILABLE = 0
# gives "disabled for party" characters EXP (specify in %)
EXP_DISABLED_FOR_PARTY = 0
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Conficuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
# recognition variable for plug-ins
$easy_party_switcher = 2.43
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_accessor :must_be_in_party
attr_accessor :disabled_for_party
attr_accessor :not_available
attr_accessor :forced_position
alias setup_eps_later setup
def setup(actor_id)
setup_eps_later(actor_id)
@must_be_in_party = @disabled_for_party = @not_available = false
end
end
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_accessor :stored_party
attr_accessor :order_only
attr_accessor :battle_order_only
attr_accessor :battle_switch
alias init_eps_later initialize
def initialize
init_eps_later
@order_only = @battle_order_only = false
@battle_switch = BlizzCFG::BATTLE_SWITCH
end
end
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
attr_accessor :actors
attr_accessor :forced_size
def any_forced_position
return (@actors.any? {|actor| actor != nil && actor.forced_position != nil})
end
end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base
alias draw_actor_graphic_eps_later draw_actor_graphic
def draw_actor_graphic(actor, x, y)
if actor != nil && actor.character_name != ''
classes = [Window_Current, Window_Reserve, Window_HelpStatus]
if BlizzCFG::FACESETS && !$all_available && classes.include?(self.class)
draw_actor_face_eps(actor, x, y)
else
if classes.include?(self.class)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
x += bitmap.width / 8 + 24
y += bitmap.height / 4 + 16
end
draw_actor_graphic_eps_later(actor, x, y)
end
end
end
def draw_actor_face_eps(actor, x, y)
if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
hue = 0
else
hue = actor.character_hue
end
bitmap = RPG::Cache.character("#{actor.character_name}_face", hue)
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
if actor.not_available || actor.must_be_in_party
self.contents.blt(x, y, bitmap, src_rect, 128)
else
self.contents.blt(x, y, bitmap, src_rect)
end
end
end
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult
attr_reader :exp
end
#==============================================================================
# Window_Current
#==============================================================================
class Window_Current < Window_Selectable
def initialize
super(0, 0, 240 + 32, (BlizzCFG::MAX_PARTY > 4 ? 480 : BlizzCFG::MAX_PARTY * 120))
self.contents = Bitmap.new(width - 32, 448 + (BlizzCFG::MAX_PARTY-4) * 120)
@item_max = BlizzCFG::MAX_PARTY
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
refresh
self.active, self.index, self.z = false, -1, 5000
end
def refresh
self.contents.clear
$game_party.actors.each_index {|i|
if $game_party.actors[i] != nil
draw_actor_graphic($game_party.actors[i], 4, i*120+4)
draw_actor_name($game_party.actors[i], 152, i*120-4)
draw_actor_level($game_party.actors[i], 88, i*120-4)
draw_actor_hp($game_party.actors[i], 88, i*120+24)
draw_actor_sp($game_party.actors[i], 88, i*120+52)
end}
end
def setactor(index_1, index_2)
$game_party.actors[index_2], $game_party.actors[index_1] =
$game_party.actors[index_1], $game_party.actors[index_2]
refresh
end
def getactor(index)
return $game_party.actors[index]
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
y = (@index / @column_max) * 120 - self.oy
self.cursor_rect.set(0, y, self.width - 32, 88)
end
def clone_cursor
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
y = (@index / @column_max) * 120
src_rect = Rect.new(0, 0, self.width, 88)
bitmap = Bitmap.new(self.width-32, 88)
bitmap.fill_rect(0, 0, self.width-32, 88, Color.new(255, 255, 255, 192))
bitmap.fill_rect(2, 2, self.width-36, 84, Color.new(255, 255, 255, 80))
self.contents.blt(0, y, bitmap, src_rect, 192)
end
def top_row
return self.oy / 116
end
def top_row=(row)
self.oy = (row % row_max) * 120
end
def page_row_max
return (self.height / 120)
end
end
#==============================================================================
# Window_Reserve
#==============================================================================
class Window_Reserve < Window_Selectable
attr_reader :actors
def initialize(scene)
super(0, 0, 368, 320)
setup
@column_max, rows = 3, @item_max / @column_max
self.contents = Bitmap.new(width - 32, (rows >= 3 ? rows * 96 : height - 32))
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
self.active, self.index, self.z = false, -1, 5000
refresh
if scene == Scene_Map && $game_system.order_only ||
scene == Scene_Battle && $game_system.battle_order_only
self.opacity = 128
end
end
def setup
@actors = []
(1...$data_actors.size).each {|i|
unless $game_party.actors.include?($game_actors[i]) ||
$game_actors[i].disabled_for_party && !$all_available
@actors.push($game_actors[i])
end}
@item_max = (@actors.size + $game_party.actors.size + 3) / 3 * 3
end
def refresh
self.contents.clear
@actors.each_index {|i| draw_actor_graphic(@actors[i], i%3*112+16, i/3*96+8)}
end
def getactor(index)
return @actors[index]
end
def get_number
return (@actors.find_all {|actor| actor != nil}).size if $all_available
return (@actors.find_all {|actor| actor != nil && !actor.not_available}).size
end
def setactor(index_1, index_2)
@actors[index_1], @actors[index_2] = @actors[index_2], @actors[index_1]
refresh
end
def setparty(index_1, index_2)
@actors[index_1], $game_party.actors[index_2] =
$game_party.actors[index_2], @actors[index_1]
refresh
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max-1) if row > top_row + (page_row_max-1)
x, y = (@index % @column_max)*112 + 8, (@index / @column_max)*96 - self.oy
self.cursor_rect.set(x, y, 96, 96)
end
def clone_cursor
row = @index / @column_max
self.top_row = row if row < self.top_row
self.top_row = row - (page_row_max - 1) if row > top_row + (page_row_max - 1)
x, y = (@index % @column_max) * 112 + 8, (@index / @column_max) * 96
src_rect = Rect.new(0, 0, 96, 96)
bitmap = Bitmap.new(96, 96)
bitmap.fill_rect(0, 0, 96, 96, Color.new(255, 255, 255, 192))
bitmap.fill_rect(2, 2, 92, 92, Color.new(255, 255, 255, 80))
self.contents.blt(x, y, bitmap, src_rect, 192)
end
def top_row
return self.oy / 96
end
def top_row=(row)
row = row % row_max
self.oy = row * 96
end
def page_row_max
return (self.height - 32) / 96
end
end
#==============================================================================
# Window_HelpStatus
#==============================================================================
class Window_HelpStatus < Window_Base
def initialize(gotactor, scene)
super(0, 0, 400 - 32, 160)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
refresh(gotactor)
self.active, self.z = false, 5000
if scene == Scene_Map && $game_system.order_only ||
scene == Scene_Battle && $game_system.battle_order_only
self.opacity = 128
end
end
def refresh(actor)
self.contents.clear
if actor != nil
self.contents.font.color = normal_color
if actor.not_available && !$all_available
self.contents.draw_text(8, 0, 160, 32, 'not available', 0)
end
draw_actor_graphic(actor, 0, 40)
draw_actor_name(actor, 160, 32)
draw_actor_level(actor, 96, 32)
draw_actor_hp(actor, 96, 64)
draw_actor_sp(actor, 96, 96)
end
end
end
#==============================================================================
# Window_Warning
#==============================================================================
class Window_Warning < Window_Base
def initialize(mode, members)
super(0, 0, 320, 96)
self.contents = Bitmap.new(width - 32, height - 32)
if $fontface != nil
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
self.contents.font.size = 24
self.x, self.y, self.z = 320 - width/2, 240 - height/2, 9999
self.contents.font.color = normal_color
case mode
when 0
self.contents.draw_text(0, 0, 288, 32, 'You need a party', 1)
num = [$game_party.forced_size, members + $game_party.actors.nitems].min
self.contents.draw_text(0, 32, 288, 32, "of #{num} members!", 1)
when 1
self.contents.draw_text(0, 0, 288, 32, 'You cannot remove', 1)
self.contents.draw_text(0, 32, 288, 32, 'the last party member!', 1)
when 2
self.contents.draw_text(0, 0, 288, 32, 'At least one member', 1)
self.contents.draw_text(0, 32, 288, 32, 'has to be alive!', 1)
end
end
end
#==============================================================================
# Window_PartyCommand
#==============================================================================
class Window_PartyCommand
alias init_eps_later initialize
def initialize
if $game_system.battle_switch
if defined?(SDK) && self.is_a?(Window_HorizCommand)
s1 = SDK::Scene_Commands::Scene_Battle::Fight
s2 = SDK::Scene_Commands::Scene_Battle::Escape
s3 = BlizzCFG::SWITCH_COMMAND
super(640, [s1, s2, s3])
disable_item(1) unless $game_temp.battle_can_escape
else
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@commands = ['Fight', 'Escape', BlizzCFG::SWITCH_COMMAND]
@item_max = @column_max = 3
draw_item(0, normal_color)
draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
draw_item(2, normal_color)
end
self.active, self.visible, self.index = false, false, 0
self.back_opacity = 160
else
init_eps_later
end
end
alias draw_item_eps_later draw_item
def draw_item(index, color)
if $game_system.battle_switch
self.contents.font.color = color
rect = Rect.new(80 + index * 160 + 4, 0, 128 - 10, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
else
draw_item_eps_later(index, color)
end
end
alias update_cursor_rect_eps_later update_cursor_rect
def update_cursor_rect
if $game_system.battle_switch
self.cursor_rect.set(80 + index * 160, 0, 128, 32)
else
update_cursor_rect_eps_later
end
end
def command(index = self.index)
return @commands[index]
end
end
#==============================================================================
# Scene_PartySwitcher
#==============================================================================
class Scene_PartySwitcher
def initialize(wipe_party = 0, reset = 0, store = 0)
@wipe_party, @store, @reset = store, reset, wipe_party
@current_window_temp = @reserve_window_temp = 0
@scene_flag, @temp_window = false, ''
@scene = $scene.class
end
def main
if @store != 0
swap_parties
$scene = Scene_Map.new
$game_player.refresh
return
end
case @wipe_party
when 1 then setup_forced_party
when 2 then wipe_party
when 3
$game_system.stored_party = $game_party.actors
wipe_party
when 10 then $all_available = true
end
if @reset == 1
(1...$data_actors.size).each {|i| $game_actors[i].not_available = false}
end
@current_window = Window_Current.new
@current_window.index, @current_window.active = 0, true
@reserve_window = Window_Reserve.new(@scene)
@reserve_window.x, @reserve_window.y = 272, 160
@help_window = Window_HelpStatus.new(@reserve_window.getactor(0), @scene)
@help_window.x = 240 + 32
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
[@current_window, @reserve_window, @help_window].each {|win| win.dispose}
$game_party.actors.compact!
$game_player.refresh
$all_available = nil
end
def update
check = @reserve_window.index
if @reserve_window.active
reserve_update
@reserve_window.update
end
if check != @reserve_window.index
if @reserve_window.active
actor = @reserve_window.getactor(@reserve_window.index)
elsif @current_window.active
actor = @reserve_window.getactor(@reserve_window_temp)
end
@help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
end
current_update if @current_window.active
if Input.trigger?(Input::B)
if @scene_flag
$game_system.se_play($data_system.cancel_se)
@scene_flag, @temp_window = false, ''
if @reserve_window.active
actor = @reserve_window.getactor(@reserve_window.index)
elsif @current_window.active
actor = @reserve_window.getactor(@reserve_window_temp)
end
@help_window.refresh(actor) if ['', 'Current'].include?(@temp_window)
[@current_window, @reserve_window].each {|win| win.refresh}
return
end
if $game_party.forced_size != nil &&
($game_party.forced_size < $game_party.actors.nitems ||
($game_party.forced_size > $game_party.actors.nitems &&
@reserve_window.get_number != 0))
$game_system.se_play($data_system.buzzer_se)
warning(1)
return
end
if $game_party.actors.all? {|actor| actor == nil ||
actor != nil && actor.dead?}
$game_system.se_play($data_system.buzzer_se)
warning(2)
return
end
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(5)
elsif Input.trigger?(Input::A)
if $game_party.any_forced_position
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
$game_party.actors.compact!
@current_window.refresh
end
end
end
def current_update
@current_window.update
if Input.trigger?(Input::C)
actor = @current_window.getactor(@current_window.index)
if actor != nil && actor.forced_position != nil
$game_system.se_play($data_system.buzzer_se)
else
if @scene_flag
switch_members
else
$game_system.se_play($data_system.decision_se)
@scene_flag, @temp_window = true, 'Current'
@temp_actor_index = @current_window.index
@current_window.clone_cursor
end
end
elsif Input.trigger?(Input::RIGHT)
if @scene == Scene_Map && $game_system.order_only ||
@scene == Scene_Battle && $game_system.battle_order_only
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.cursor_se)
@current_window.active = false
@reserve_window.active = true
@current_window_temp = @current_window.index
actor = @reserve_window.getactor(@reserve_window_temp)
@current_window.index = -1
@reserve_window.index = @reserve_window_temp
@help_window.refresh(actor) unless @scene_flag
end
end
end
def reserve_update
if Input.trigger?(Input::C)
if @scene_flag
switch_members
else
$game_system.se_play($data_system.decision_se)
@scene_flag, @temp_window = true, 'Reserve'
@temp_actor_index = @reserve_window.index
@reserve_window.clone_cursor
end
elsif @reserve_window.index % 3 == 0 && Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@reserve_window.active = false
@current_window.active = true
@reserve_window_temp = @reserve_window.index
@reserve_window.index = -1
@current_window.index = @current_window_temp
end
end
def switch_members
if @temp_window == 'Reserve' && @reserve_window.active
@reserve_window.setactor(@temp_actor_index, @reserve_window.index)
actor = @reserve_window.getactor(@reserve_window.index)
@help_window.refresh(actor)
end
if @temp_window == 'Current' && @current_window.active
@current_window.setactor(@temp_actor_index, @current_window.index)
end
if @temp_window == 'Reserve' && @current_window.active
actor1 = @current_window.getactor(@current_window.index)
actor2 = @reserve_window.getactor(@temp_actor_index)
if call_warning?(@current_window.index, actor2)
if actor1 != nil && actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window_temp)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
if actor2 != nil && actor2.not_available && !$all_available
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window_temp)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
@reserve_window.setparty(@temp_actor_index, @current_window.index)
@current_window.refresh
actor = @reserve_window.getactor(@reserve_window_temp)
@help_window.refresh(actor)
else
warning(0)
end
end
if @temp_window == 'Current' && @reserve_window.active
actor1 = @current_window.getactor(@temp_actor_index)
actor2 = @reserve_window.getactor(@reserve_window.index)
if call_warning?(@temp_actor_index, actor2)
if actor1 != nil && actor1.must_be_in_party
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window.index)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
if actor2 != nil && actor2.not_available && !$all_available
$game_system.se_play($data_system.buzzer_se)
@scene_flag, @temp_window = false, ''
actor = @reserve_window.getactor(@reserve_window.index)
[@current_window, @reserve_window].each {|win| win.refresh}
@help_window.refresh(actor)
return
end
@reserve_window.setparty(@reserve_window.index, @temp_actor_index)
@current_window.refresh
actor = @reserve_window.getactor(@reserve_window.index)
@help_window.refresh(actor)
else
warning(0)
end
end
$game_system.se_play($data_system.decision_se)
@scene_flag, @temp_window = false, ''
end
def wipe_party
$game_party.actors.each {|actor| actor.not_available = true if actor != nil}
setup_forced_party(true)
if $game_party.actors == []
(1...$data_actors.size).each {|i|
unless $game_actors[i].not_available ||
$game_actors[i].disabled_for_party
$game_party.actors.push($game_actors[i])
return
end}
end
end
def setup_forced_party(flag = false)
$game_party.actors, party = [], []
(1...$data_actors.size).each {|i|
if $game_actors[i] != nil && $game_actors[i].must_be_in_party &&
(!$game_actors[i].disabled_for_party || flag) &&
!$game_actors[i].not_available
party.push($game_actors[i])
end}
party.clone.each {|actor|
if actor.forced_position != nil
$game_party.actors[actor.forced_position] = actor
party.delete(actor)
end}
$game_party.actors.each_index {|i|
$game_party.actors[i] = party.shift if $game_party.actors[i] == nil}
$game_party.actors += party.compact
end
def swap_parties
$game_party.actors.compact!
temp_actors = $game_party.actors
temp_actors.each {|actor| actor.not_available = true}
$game_system.stored_party.compact!
$game_system.stored_party.each {|actor| actor.not_available = false}
$game_party.actors = $game_system.stored_party
$game_system.stored_party = (@store == 1 ? temp_actors : nil)
end
def call_warning?(index, actor2)
return (BlizzCFG::ALLOW_EMPTY_PARTY || $game_party.actors[index] == nil ||
actor2 != nil || $game_party.actors.nitems > 1)
end
def warning(type)
$game_system.se_play($data_system.buzzer_se)
@warning_window = Window_Warning.new(type, @reserve_window.get_number)
loop do
Graphics.update
Input.update
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se) if type > 0
[@current_window, @reserve_window].each {|win| win.refresh}
@warning_window.dispose
@warning_window = nil
break
end
end
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias update_phase2_eps_later update_phase2
def update_phase2
update_phase2_eps_later
if Input.trigger?(Input::C) && @party_command_window.index == 2
$game_system.se_play($data_system.decision_se)
@spriteset.dispose
$scene = Scene_PartySwitcher.new
$scene.main
$scene = self
@spriteset = Spriteset_Battle.new
15.times {@spriteset.update}
@status_window.refresh
Graphics.transition(0)
end
end
alias start_phase5_eps_later start_phase5
def start_phase5
start_phase5_eps_later
(1...$data_actors.size).each {|i|
unless $game_party.actors.include?($game_actors[i])
if $game_actors[i].not_available
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_NOT_AVAILABLE/100
elsif $game_actors[i].disabled_for_party
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_DISABLED_FOR_PARTY/100
else
$game_actors[i].exp += @result_window.exp * BlizzCFG::EXP_RESERVE/100
end
end}
end
end
#==============================================================================
# DerVVulfman's Limit Break Menu v 2.7
# By Alistor, with Edits by DerVVulfman
# Original Concept by SephirothSpawn
#==============================================================================
# This script has an Auto-Detect function that, when used with SDK, replaces the
# internal Window_HorizCommand with the SDK version. Thanks go to DerVVulfman for that
# method. Added a second Auto-Detect function that, when used with the Attack Replacer LB
# Add-On, removes limits from the skill window in battle and vice-versa.
#==============================================================================
#=======================================================================#
# ** C O N F I G U R A T I O N S Y S T E M ** #
#=======================================================================#
# Allows you to hide SP values of zero:
# =====================================
HIDE_ZERO_SP = true
# Basic Menu Text:
# ================
LB_MENU_TITLE = 'Limits' # Menu Title
LB_HEADING_1 = 'View Limits' # Option 1 Text: List of Limit Break Skills
LB_HEADING_2 = 'Set Gain Mode' # Option 2 Text: List of Limit Break Types
# Preset Gain Mode Help Text System:
# =================================+
# This customizes the text shown after you choose the limit break style for an
# actor. Originally hardwired, you can now edit the layout right here.
#
# {lb_a_name} :Actor's Name
# {lb_a_type} :Actor's Gain Mode Text (Limit Type)
LB_GAIN_TEXT = "{lb_a_name}'s Gain Mode is Now {lb_a_type}"
# - Sample output: Aluxes's Gain Mode is now Stotic -
#
# Optionally, you could have it be this:
# LB_GAIN_TEXT = "Gain Mode of {lb_a_type} now set to {lb_a_name}"
# - Sample output: Gain Mode of Victor now set to Gloria -
# Array of Limit Break types:
# ===========================
# This allows you to list the limit break styles or settings available in your
# system. You can choose to list them in any order and pick and choose whether
# a limit break style will even be in your game. You no longer have to use
# 'all' the limit break types available. And as such, this system is already
# designed to accomodate any newer limit break types not yet available.
#
# Idx: The index/setting of a 'limit break type' as defined by LB_START
# Type Name: The basic choice/option of a 'limit break type' in the menu
# Type Desc: A help text description of a 'limit break type'
#
# FORMAT:
# LB_MENU_ARRAY = [ [Limit Array], [Limit Array],... ]
# with...
# Limit Array = [Idx(as number), Type Name(as string), Type Desc(as string)]
#
# NOTE: The array can be set in any order, so the menu options can be arranged
# in any order. What controls the limit break type in use is the 'Idx'
# number in the array.
#
# Idx Type Name Type Desc
LB_MENU_ARRAY = [ [0, 'Warrior', 'Warrior - Gains When Hero Damages Enemy'] ,
[1, 'Heavy Hitter', 'Heavy Hitter - Gains When Hero Lands a Critical Hit'],
[2, 'Stoic', 'Stoic - Gains When Hero Receives Damage'] ,
[3, 'Slayer', 'Slayer - Gains When Hero Kills Enemy'],
[4, 'Godslayer', 'GodSlayer - Gains When Hero Defeats a Boss'],
[5, 'Victim', 'Victim - Gains When Hero is Slain'],
[6, 'Victor', 'Victor - Gains When Party Wins Battle'],
[7, 'Coward', 'Coward - Gains When Hero Escapes Battle'],
[8, 'Defender', 'Defender - Gains When Hero Chooses to Guard'],
[9, 'Loner', 'Loner - Gains When Hero Is Only Member in Party'],
[10, 'Active', 'Active - Gains When Hero Performs an Action'],
[11, 'Daredevil', 'Daredevil - Gains When Hero is in Critical Condition'] ]
#=======================================================================#
# C O N F I G U R A T I O N S Y S T E M E N D #
#=======================================================================#
#==============================================================================
# ** RMXP Standard Development Kit (SDK)
#------------------------------------------------------------------------------
# A system aimed to increase compatibility between RGSS scripts
#==============================================================================
module SDK
# Set Autodetect global to false
$lbadd_menu_sdk = false
# SDK Autodetect routine
if defined?(log_alias)
# Set Autodetect global to true
$lbadd_menu_sdk = true
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :lb_attack_detected
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lbadd1_init initialize
def initialize
lbadd1_init
if @lb_height != nil
@lb_attack_detected = true
end
end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :seperation # Seperation flag
attr_accessor :limitbreak_skills # Limit Break skill flag
attr_accessor :limit_menu # Limit Break menu flag
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lbadd1_init initialize
def initialize
lbadd1_init
@seperation = true
@limitbreak_skills = false
@limit_menu = false
end
end
#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill and battle screens.
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
unless $gnd_lb_patch
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
unless @actor == nil
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
unless skill == nil
if $game_temp.seperation
if $game_temp.limitbreak_skills
@data.push(skill) if skill.element_set.include?($lb_element_id)
else
@data.push(skill) unless skill.element_set.include?($lb_element_id)
end
else
@data.push(skill)
end
end
end
end
# If item count is not 0, make a bit map and draw all items
@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
$game_temp.seperation = true
$game_temp.limitbreak_skills = false
end
end
#--------------------------------------------------------------------------
# * Draw 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
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)
unless HIDE_ZERO_SP && skill.sp_cost == 0
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
#--------------------------------------------------------------------------
# * Check Data
#--------------------------------------------------------------------------
def data
return @data
end
end
#==============================================================================
# ** Window Horizontal Command (conditional on SDK system)
#------------------------------------------------------------------------------
# This window deals with general command choices, horizontally.
#==============================================================================
# If no SDK exists...
if !$lbadd_menu_sdk
# Use the Non-SDK system
class Window_HorizCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(commands, width = 640, height = 64)
super(0, 0, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
@commands = commands
@item_max = @commands.size
@column_max = @commands.size
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
x = width / @item_max * index
off = width / @item_max - 32
self.contents.draw_text(x, 0, off, 32, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
end
#==============================================================================
# ** Scene_LimitMenu
#------------------------------------------------------------------------------
# This class performs limit break screen processing.
#==============================================================================
class Scene_LimitMenu
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
# Attach the Limit Menu flag
$game_temp.limit_menu = true
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
if @actor_index < $game_party.actors.size
@actor = $game_party.actors[@actor_index]
else
@actor = $game_party.reserve_actors[@actor_index - $game_party.actors.size]
end
# Make Help Window
@help_window = Window_Help.new
# Command Window
# If the SDK is disabled
if $lbadd_menu_sdk
@command_window = Window_HorizCommand.new(640, [LB_HEADING_1, LB_HEADING_2])
else
@command_window = Window_HorizCommand.new([LB_HEADING_1, LB_HEADING_2])
end
@command_window.y = 128
# Skill Window
@skill_window = Window_Skill.new(@actor)
@skill_window.y = 192
@skill_window.height = 288
$game_temp.seperation = true
$game_temp.limitbreak_skills = true
@skill_window.refresh
@skill_window.active = false
# Skill Status Window
@status_window = Window_SkillStatus.new(@actor)
@status_window.y = 64
# Limit Break Types Window
@lb_type_window = Window_Limit_Types.new
@lb_type_window.y = 192
@lb_type_window.index = @actor.lb_type
@lb_type_window.visible = @lb_type_window.active = false
# Associate help window
if @skill_window.help_window == nil
@help_window.set_text(LB_MENU_TITLE, 1)
else
@skill_window.help_window = @help_window
end
# Scene Objects
@objects = [@help_window, @command_window, @skill_window, @lb_type_window, @status_window]
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Objects Update
@objects.each {|x| x.update}
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of Objects
@objects.each {|x| x.dispose}
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If Main Command Active : call update_main
if @command_window.active
update_main
return
end
# If skill window is active: call update_skill
if @skill_window.active
update_skill
return
end
# If Limit Type is active: call update_type
if @lb_type_window.active
update_type
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if main window is active)
#--------------------------------------------------------------------------
def update_main
# Toggles Windows Visiblity
@skill_window.visible = @command_window.index == 0 ? true : false
@lb_type_window.visible = @command_window.index == 1 ? true : false
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(7)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch Point
case @command_window.index
when 0 # View Skills
if @skill_window.data.size == 0
$game_system.se_play($data_system.buzzer_se)
@help_window.set_text(LB_MENU_TITLE, 1)
else
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@skill_window.active = true
end
when 1 # Set Limit Break Type
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@lb_type_window.active = true
@help_window.set_text(@lb_type_window.help_text, 1)
end
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_LimitMenu.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_LimitMenu.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if main window is active)
#--------------------------------------------------------------------------
def update_skill
# Refreshes Help Window Text
@skill_window.help_window = @help_window
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@help_window.set_text(LB_MENU_TITLE, 1)
# Switch to main menu
@command_window.active = true
@skill_window.active = false
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if main window is active)
#--------------------------------------------------------------------------
def update_type
# Refreshes Help Window Text (if triggered once or pressed continuously)
if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) ||
Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT) ||
Input.press?(Input::UP) || Input.press?(Input::DOWN) ||
Input.press?(Input::RIGHT) || Input.press?(Input::LEFT)
@help_window.set_text(@lb_type_window.help_text, 1)
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@help_window.set_text(LB_MENU_TITLE, 1)
# Switch to main menu
@command_window.active = true
@lb_type_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play cancel SE
$game_system.se_play($data_system.decision_se)
# Retrieve Limit Type from array
actor_lb_type = LB_MENU_ARRAY[@lb_type_window.index][0]
# Set Actor Limit Type
@actor.lb_type = actor_lb_type
# Set the character's gain text
lb_a_name = @actor.name
lb_a_type = LB_MENU_ARRAY[@lb_type_window.index][1]
text = LB_GAIN_TEXT.dup
begin
text[/{lb_a_name}/] = "#{lb_a_name}"
rescue
end
begin
text[/{lb_a_type}/] = "#{lb_a_type}"
rescue
end
@help_window.set_text(text, 1)
return
end
end
end
#==============================================================================
# ** Window_Limit_Types
#------------------------------------------------------------------------------
# This window displays the available limit types on the limit break screen.
#==============================================================================
class Window_Limit_Types < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 288)
@column_max = 2
@data = []
for i in 0...LB_MENU_ARRAY.size
@data.push(LB_MENU_ARRAY[1])
end
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Get Type
#--------------------------------------------------------------------------
def get_type
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Help Text
#--------------------------------------------------------------------------
def help_text
for i in 0...LB_MENU_ARRAY.size
text = LB_MENU_ARRAY[2] if LB_MENU_ARRAY
* == index
end
return text
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# If item count is not 0, make a bit map and draw all items
@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
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
self.contents.draw_text(x, y, contents.width / 2 - 32, 32, @data[index], 1)
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias lbmenu_main main
def main
# Autodetect value added
@lb_menu = true
# Perform the original call
lbmenu_main
end
#--------------------------------------------------------------------------
# * Start Skill Selection
#--------------------------------------------------------------------------
unless $gnd_lb_patch
def start_skill_select
# RTAB detection value built into Limit Break (DVV)
# Assigns 'battler' value for the Skill Window.
if $game_system.lb_rtab_detected
battler = @active_actor
else
battler = @active_battler
end
# Make skill window
@skill_window = Window_Skill.new(battler)
if $game_system.lb_attack_detected
$game_temp.seperation = true
$game_temp.limitbreak_skills = false
@skill_window.refresh
else
$game_temp.seperation = false
$game_temp.limitbreak_skills = false
@skill_window.refresh
end
@skill_window.z = 1000
# Associate help window
@skill_window.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
end
end