Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Yanfly Engine Zealous - Party Selection System
- # Last Date Updated: 2010.01.21
- # Level: Normal, Hard, Lunatic
- #
- # By default, RPG Maker VX lacks a menu that allows for party switching. If a
- # player reaches four members, any newer members added would be simply ignored
- # unless the player has enough members and re-run the event again. With this
- # script, players will finally be able to adjust the party the way they want.
- #
- #===============================================================================
- # Updates
- # -----------------------------------------------------------------------------
- # o 2010.01.21 - Scrolling efficiency update.
- # o 2010.01.03 - Victory Aftermath Compatibility.
- # o 2010.01.02 - Variable Control Bugfix.
- # - Moved playtime up in the save window.
- # o 2010.01.01 - Shop display fixed to show only battle members.
- # o 2009.12.31 - Reserve party members now have their states updated.
- # o 2009.12.27 - All Dead-Party Bugfix.
- # - Efficiency update.
- # o 2009.12.24 - Script finished.
- # o 2009.12.22 - Started Script.
- #===============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #
- # -----------------------------------------------------------------------------
- # Module Edit Requirements
- # -----------------------------------------------------------------------------
- # Search for ENABLE_SWITCH and BATTLE_SWITCH. Bind these two constants to the
- # proper switch ID's you wish to associate them with.
- #
- # -----------------------------------------------------------------------------
- # Script Commands - These are used with the Event Editor's Script command.
- # -----------------------------------------------------------------------------
- # $game_party.fix_actor(n)
- # Makes it so that the actor cannot be taken out of the party. Requires the
- # actor to be in the party already.
- #
- # $game_party.unfix_actor(n)
- # Allows the actor to be taken out of the party again. Requires the actor to
- # be in the party already.
- #
- # $game_party.set_battlers(n1, n2, n3, n4)
- # Allows you to set a party the way you want it to. Actors must have joined
- # or else no changes will be made to that slot.
- #
- #===============================================================================
- # Compatibility
- # -----------------------------------------------------------------------------
- # - Works With: YEZ Battle Engine Zealous, YEZ Main Menu Zealous
- # -----------------------------------------------------------------------------
- # Note: This script may not work with former Yanfly Engine ReDux scripts.
- # Use Yanfly Engine Zealous scripts to work with this if available.
- # Thanks to KGC Software for a lot of reference work.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["PartySelectionSystem"] = true
- module YEZ
- module PARTY
- #===========================================================================
- # Basic Settings
- # -------------------------------------------------------------------------
- # This here allows you to adjust the basic settings that govern the overall
- # party changing scene. Change them as you see fitting.
- #===========================================================================
- # These two items adjust how the party command appears in your main menu.
- TITLE = "Party"
- ICON = 85
- # This switch needs to be on before the party change option will appear in
- # the main menu. Bind it properly to use it.
- ENABLE_SWITCH = 42
- BATTLE_SWITCH = 43
- BATTLE_DEFAULT = false # Set to true to have it on by default.
- # This is mostly used for eventing and determining which members are in the
- # party by storing their ID's inside of these following variables. Adjusted
- # whenever the player refreshes (quite often).
- VAR_PARTY_MEM1 = 41
- VAR_PARTY_MEM2 = 42
- VAR_PARTY_MEM3 = 43
- VAR_PARTY_MEM4 = 44
- # This variable is used for setting a focused character to be visible when
- # traveling on the field for story purposes. Whatever this variable equals,
- # that character will be displayed instead of whoever is the party leader.
- VAR_FOCUSED = 45
- # This is the maximum number of members that can be in your active party
- # at once. Going over this number will result in a bitmap error that can't
- # be corrected by scripts alone.
- MAXIMUM_MEMBERS = 3
- # Setting this to true will cause status effects to update and take effect
- # for actors in the battle reserve.
- RESERVE_STATES_EFFECT = true
- # Determines what percentage of the EXP won is given to non-participating
- # party members. 0.50 means 50%.
- BATTLE_RESERVE_EXP = 0.25
- # This will show the level up messages for characters in the reserve if
- # they did indeed level.
- RESERVE_LEVEL_UP = true
- #===========================================================================
- # Party Switching Settings
- # -------------------------------------------------------------------------
- # The following settings adjust what appears within the party switching
- # scene from the various ways to sort actors to the vocabulary used.
- #===========================================================================
- # The following adjusts the assort menu. The default list consists as such.
- # :story, :name, :class, :level, :hp, :mp, :atk, :def, :spi, :res,
- # :dex, :agi, :hit, :eva, :cri, :dur, :luk, :odds
- ASSORT_COMMANDS =[
- :name, :story, :class, :level, :hp, :mp, :atk, :def, :spi, :res,
- :dex, :agi, :hit, :eva, :cri, :dur, :luk, :odds
- ] # Do not remove this.
- # This little array here allows you to set certain actors as higher
- # priority for story sorting than other actors. Unlisted actors will have
- # their positions unchanged other than being lower on the list than the
- # story priority characters.
- STORY_SORTING = [1..4, 6]
- # The following hash adjusts the vocabulary used for all of the party
- # switching scene. Adjust the vocabulary as you see fit.
- VOCAB ={
- :clear => "Remove",
- :empty => "Empty",
- :nodata => "No Data",
- :c_battler => "Change",
- :b_battler => "Finish",
- :a_battler => "Remove",
- :x_battler => "Revert",
- :c_actors => "Select",
- :b_actors => "Cancel",
- :a_actors => "Assort",
- :x_actors => "Revert",
- :sort_by => "Sort Actors...",
- :story => "By Story",
- :name => "By Name",
- :class => "By Class",
- :level => "By Level",
- :stat => "By %s",
- } # Do not remove this.
- # The following determines how the game displays the keys inside of the
- # help window. %s will be the instruction following.
- KEYS ={
- :a => "A:%s",
- :b => "B:%s",
- :c => "C:%s",
- :x => "X:%s",
- } # Do not remove this.
- # This here is a list of the stats shown in the status window. Certain stats
- # will not appear unless certain scripts are installed. The order you place
- # these stats will be the order they appear in the window.
- # :atk, :def, :spi, :res, :dex, :agi, :hit, :eva, :cri, :dur, :luk, :odds
- SHOWN_STATS = [:atk, :def, :spi, :res, :dex, :agi,
- :hit, :eva, :cri, :dur, :luk, :odds]
- # These are the misc visual adjustments you can make the scene.
- FACE_OPACITY = 255 # Face opacity for battler window.
- SPRITE_OFFSET = 12 # Sprite offset for party list.
- ACTIVE_COLOUR = 6 # Highlighted Name Colour
- CLEAR_ICON = 98 # This is used for clearing an actor.
- UP_ICON = 142 # These are the icons used when stats are higher
- DN_ICON = 143 # or lower than their base amounts.
- LOCKED_ICON = 80 # Icon used for locked actors.
- #===========================================================================
- # Menu Status Window
- # -------------------------------------------------------------------------
- # When viewing the main menu, the status window will now host the extra
- # party members that aren't participating in battle.
- #===========================================================================
- # This adjusts the back colour opacity for non-battle members inside of
- # the main menu's party window.
- BACK_OPACITY = 64
- # This adjusts the way EXP bars are displayed inside the main menu status
- # window. Adjust it as you see fit.
- EXP_TEXT = "EXP" # Text used for EXP
- PERCENT_EXP = "%1.2f%%" # Text format used for EXP percentage
- EXP_GAUGE_1 = 28 # Colour 1 for the EXP Gauge
- EXP_GAUGE_2 = 29 # Colour 2 for the EXP Gauge
- end # PARTY
- end # YEZ
- #===============================================================================
- # Editting anything past this point may potentially result in causing computer
- # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
- # Therefore, edit at your own risk.
- #===============================================================================
- module YEZ::PARTY
- module_function
- #--------------------------------------------------------------------------
- # convert_integer_array
- #--------------------------------------------------------------------------
- def convert_integer_array(array)
- result = []
- array.each { |i|
- case i
- when Range; result |= i.to_a
- when Integer; result |= [i]
- end }
- return result
- end
- #--------------------------------------------------------------------------
- # story_sorting_list
- #--------------------------------------------------------------------------
- STORY_SORTING_LIST = convert_integer_array(STORY_SORTING)
- end # YEZ::PARTY
- module Vocab
- def self.hit; return "HIT"; end
- def self.eva; return "EVA"; end
- def self.cri; return "CRI"; end
- def self.odds;return "AGR"; end
- end # Vocab
- #===============================================================================
- # Game_Party
- #===============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # constants
- #--------------------------------------------------------------------------
- MAX_MEMBERS = [[YEZ::PARTY::MAXIMUM_MEMBERS, 99].min, 1].max
- BATTLE_MAX = 4
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :actors
- attr_accessor :battlers
- attr_accessor :fixed_actors
- #--------------------------------------------------------------------------
- # alias method: members
- #--------------------------------------------------------------------------
- alias members_pss members unless $@
- def members
- if $game_temp.in_battle or $scene.is_a?(Scene_Shop)
- return battle_members
- else
- result = []
- for member in battle_members
- result.push(member)
- end
- for member in all_members
- result.push(member) unless result.include?(member)
- end
- return result
- end
- end
- #--------------------------------------------------------------------------
- # new method: all_members
- #--------------------------------------------------------------------------
- def all_members; return members_pss.uniq; end
- #--------------------------------------------------------------------------
- # new method: reserve_members
- #--------------------------------------------------------------------------
- def reserve_members; return (members_pss - battle_members).uniq; end
- #--------------------------------------------------------------------------
- # new method: battle_members
- #--------------------------------------------------------------------------
- def battle_members
- if @battlers == nil
- @battlers = [0, 0, 0, 0]
- for i in 0..([@actors.size, BATTLE_MAX].min - 1)
- @battlers[i] = @actors[i]
- end
- end
- result = []
- for id in @battlers
- result.push($game_actors[id]) unless $game_actors[id] == nil
- end
- return result
- end
- #--------------------------------------------------------------------------
- # new method: set_battlers
- #--------------------------------------------------------------------------
- def set_battlers(n1 = 0, n2 = 0, n3 = 0, n4 = 0)
- battle_members if @battlers == nil
- n1 = @battlers[0] unless @actors.include?(n1)
- n2 = @battlers[1] unless @actors.include?(n2)
- n3 = @battlers[2] unless @actors.include?(n3)
- n4 = @battlers[3] unless @actors.include?(n4)
- @battlers = [n1, n2, n3, n4]
- $game_player.refresh
- end
- #--------------------------------------------------------------------------
- # new method: fixed_members
- #--------------------------------------------------------------------------
- def fixed_members
- result = []
- @fixed_actors = [] if @fixed_actors == nil
- for id in @fixed_actors
- result.push($game_actors[id]) unless $game_actors[id] == nil
- end
- return result
- end
- #--------------------------------------------------------------------------
- # new method: fix_actor
- #--------------------------------------------------------------------------
- def fix_actor(actor_id)
- @fixed_actors = [] if @fixed_actors == nil
- battle_members if @battlers == nil
- return unless @battlers.include?(actor_id)
- @fixed_actors.push(actor_id)
- end
- #--------------------------------------------------------------------------
- # new method: unfix_actor
- #--------------------------------------------------------------------------
- def unfix_actor(actor_id)
- @fixed_actors = [] if @fixed_actors == nil
- return unless @battlers.include?(actor_id)
- @fixed_actors.delete(actor_id)
- end
- #--------------------------------------------------------------------------
- # alias method: setup_starting_members
- #--------------------------------------------------------------------------
- alias setup_starting_members_pss setup_starting_members unless $@
- def setup_starting_members
- setup_starting_members_pss
- $game_switches[YEZ::PARTY::ENABLE_SWITCH] = true
- $game_switches[YEZ::PARTY::BATTLE_SWITCH] = YEZ::PARTY::BATTLE_DEFAULT
- end
- #--------------------------------------------------------------------------
- # alias method: add_actor
- #--------------------------------------------------------------------------
- alias add_actor_pss add_actor unless $@
- def add_actor(actor_id)
- last_size = @actors.size
- add_actor_pss(actor_id)
- if last_size < @actors.size
- battle_members if @battlers == nil
- for i in 0..(@battlers.size-1)
- if @battlers[i] == 0
- @battlers[i] = actor_id
- break
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # alias method: remove_actor
- #--------------------------------------------------------------------------
- alias remove_actor_pss remove_actor unless $@
- def remove_actor(actor_id)
- battle_members if @battlers == nil
- @battlers[@battlers.index(actor_id)] = 0 if @battlers.include?(actor_id)
- remove_actor_pss(actor_id)
- end
- end # Game_Party
- #===============================================================================
- # Game_Player
- #===============================================================================
- class Game_Player < Game_Character
- #--------------------------------------------------------------------------
- # alias method: refresh
- #--------------------------------------------------------------------------
- alias refresh_player_pss refresh unless $@
- def refresh
- refresh_player_pss
- if $game_variables[YEZ::PARTY::VAR_FOCUSED] > 0
- actor = $game_actors[$game_variables[YEZ::PARTY::VAR_FOCUSED]]
- @character_name = actor.character_name
- @character_index = actor.character_index
- end
- return if $game_party.members.size == 0
- bat = $game_party.battle_members
- $game_variables[YEZ::PARTY::VAR_PARTY_MEM1] = bat.size > 0 ? bat[0].id : 0
- $game_variables[YEZ::PARTY::VAR_PARTY_MEM2] = bat.size > 1 ? bat[1].id : 0
- $game_variables[YEZ::PARTY::VAR_PARTY_MEM3] = bat.size > 2 ? bat[2].id : 0
- $game_variables[YEZ::PARTY::VAR_PARTY_MEM4] = bat.size > 3 ? bat[3].id : 0
- end
- end # Game_Player
- #===============================================================================
- # Game_Interpreter
- #===============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # alias method: control variable
- #--------------------------------------------------------------------------
- alias command_122_pss command_122 unless $@
- def command_122
- n = command_122_pss
- $game_player.refresh if @params[0] == YEZ::PARTY::VAR_FOCUSED
- return n
- end
- end # Game_Interpreter
- #===============================================================================
- # Scene_Menu
- #===============================================================================
- class Scene_Menu < Scene_Base
- #--------------------------------------------------------------------------
- # alias method: create_command_window
- #--------------------------------------------------------------------------
- alias create_command_window_pss create_command_window unless $@
- def create_command_window
- create_command_window_pss
- return if $imported["CustomMenuCommand"]
- if $game_switches[YEZ::PARTY::ENABLE_SWITCH] and
- $game_party.all_members.size > 1
- title = YEZ::PARTY::TITLE
- @command_party = @command_window.add_command(title)
- if @command_window.oy > 0
- @command_window.oy -= Window_Base::WLH
- end
- end
- @command_window.index = @menu_index
- end
- #--------------------------------------------------------------------------
- # alias method: update_command_selection
- #--------------------------------------------------------------------------
- alias update_command_selection_pss update_command_selection unless $@
- def update_command_selection
- call_yez_command = 0
- if Input.trigger?(Input::C)
- case @command_window.index
- when @command_party
- Sound.play_decision
- $scene = Scene_Party.new(@command_window.index, Scene_Party::HOST_MENU)
- return
- end
- end
- update_command_selection_pss
- end
- end # Scene Menu
- #===============================================================================
- # Scene_Battle
- #===============================================================================
- class Scene_Battle < Scene_Base
- if YEZ::PARTY::RESERVE_STATES_EFFECT
- #--------------------------------------------------------------------------
- # alias method: start_main
- #--------------------------------------------------------------------------
- if $imported["CustomStatusPropertiesZeal"]
- alias start_main_pss start_main unless $@
- def start_main
- start_main_pss
- for member in $game_party.reserve_members
- for state in member.states;
- member.custom_status_effects(state, "BEGIN")
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # alias method: turn_end
- #--------------------------------------------------------------------------
- alias turn_end_pss turn_end unless $@
- def turn_end
- for member in $game_party.reserve_members
- member.slip_damage_effect
- member.do_auto_recovery
- member.remove_states_auto
- end
- turn_end_pss
- end
- end # YEZ::PARTY::RESERVE_STATES_EFFECT
- #--------------------------------------------------------------------------
- # alias method: display_level_up
- #--------------------------------------------------------------------------
- unless $imported["VictoryAftermath"]
- alias display_level_up_pss display_level_up unless $@
- def display_level_up
- display_level_up_pss
- exp = Integer($game_troop.exp_total * YEZ::PARTY::BATTLE_RESERVE_EXP)
- for actor in $game_party.reserve_members
- actor.gain_exp(exp, YEZ::PARTY::RESERVE_LEVEL_UP) if actor.exist?
- end
- wait_for_message
- end
- end
- #--------------------------------------------------------------------------
- # alias method: battle_end
- #--------------------------------------------------------------------------
- alias battle_end_pss battle_end unless $@
- def battle_end(result)
- battle_end_pss(result)
- for member in $game_party.reserve_members
- member.remove_states_battle
- end
- end
- end # Scene_Battle
- #===============================================================================
- # Scene_Party
- #===============================================================================
- class Scene_Party < Scene_Base
- #--------------------------------------------------------------------------
- # constants
- #--------------------------------------------------------------------------
- HOST_MENU = 0
- HOST_MAP = 1
- HOST_BATTLE = 2
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0, host_menu = HOST_MENU)
- @menu_index = menu_index
- @host_menu = host_menu
- end
- #--------------------------------------------------------------------------
- # start
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- @battlers_window = Window_PartyBattlers.new
- @actors_window = Window_PartyActors.new
- @help_window = Window_PartyHelp.new
- @status_window = Window_PartyStatus.new
- @status_window.refresh(@battlers_window.item)
- create_assort_back_window
- @assort_window = Window_PartyAssort.new
- @original_party = $game_party.battlers.clone
- @original_order = $game_party.actors.clone
- @last_battler_index = 0
- @last_actor_index = 0
- end
- #--------------------------------------------------------------------------
- # create_assort_back_window
- #--------------------------------------------------------------------------
- def create_assort_back_window
- @assort_back = Window_Base.new(160, 128, 384, 288)
- @assort_back.contents.clear
- text = YEZ::PARTY::VOCAB[:sort_by]
- @assort_back.contents.draw_text(0, 0, 344, 36, text, 1)
- @assort_back.visible = false
- end
- #--------------------------------------------------------------------------
- # terminate
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- @battlers_window.dispose if @battlers_window != nil
- @actors_window.dispose if @actors_window != nil
- @help_window.dispose if @help_window != nil
- @status_window.dispose if @status_window != nil
- @assort_window.dispose if @assort_window != nil
- @assort_back.dispose if @assort_back != nil
- end
- #--------------------------------------------------------------------------
- # return_scene
- #--------------------------------------------------------------------------
- def return_scene
- case @host_menu
- when HOST_MAP
- $scene = Scene_Map.new
- when HOST_BATTLE
- $scene = Scene_Battle.new
- when HOST_MENU
- if $imported["CustomMenuCommand"] and
- $game_temp.menu_command_index.has_key?(:party)
- $scene = Scene_Menu.new($game_temp.menu_command_index[:party])
- else
- $scene = Scene_Menu.new(@menu_index)
- end
- end
- $game_player.refresh
- end
- #--------------------------------------------------------------------------
- # update
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- if @battlers_window.active
- update_battlers_window
- elsif @actors_window.active
- update_actors_window
- elsif @assort_window.active
- update_assort_window
- end
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- @battlers_window.refresh
- @actors_window.refresh
- if @battlers_window.active
- @status_window.refresh(@battlers_window.item) if @battlers_window.item !=
- @status_window.item
- elsif @actors_window.active
- @status_window.refresh(@actors_window.item) if @actors_window.item !=
- @status_window.item
- end
- $game_player.refresh
- end
- #--------------------------------------------------------------------------
- # update_battlers_window
- #--------------------------------------------------------------------------
- def update_battlers_window
- @battlers_window.update
- @help_window.refresh(1) if @help_window.type != 1
- if @last_battler_index != @battlers_window.index
- @last_battler_index = @battlers_window.index
- @status_window.refresh(@battlers_window.item) if @battlers_window.item !=
- @status_window.item
- end
- if Input.trigger?(Input::B)
- if @battlers_window.selected_index == nil
- if $game_party.battle_members == []
- Sound.play_buzzer
- elsif $game_party.all_dead?
- Sound.play_buzzer
- else
- for actor in $game_party.fixed_members
- next if $game_party.battle_members.include?(actor)
- Sound.play_buzzer
- return
- end
- Sound.play_cancel
- return_scene
- end
- else
- @battlers_window.selected_index = nil
- refresh
- end
- elsif Input.trigger?(Input::A)
- id = @battlers_window.item
- if id != 0 and $game_party.fixed_members.include?($game_actors[id])
- Sound.play_buzzer
- return
- end
- Sound.play_equip
- index = @battlers_window.index
- $game_party.battlers[index] = 0
- refresh
- elsif Input.trigger?(Input::X)
- Sound.play_equip
- $game_party.battlers = @original_party.clone
- refresh
- elsif Input.trigger?(Input::L)
- Sound.play_equip
- index1 = @battlers_window.index
- index2 = index1 - 1
- temp = $game_party.battlers[index1]
- $game_party.battlers[index1] = $game_party.battlers[index2]
- $game_party.battlers[index2] = temp
- @battlers_window.index -= 1
- @battlers_window.index = 3 if @battlers_window.index < 0
- refresh
- elsif Input.trigger?(Input::R)
- Sound.play_equip
- index1 = @battlers_window.index
- index2 = index1 - 3
- temp = $game_party.battlers[index1]
- $game_party.battlers[index1] = $game_party.battlers[index2]
- $game_party.battlers[index2] = temp
- @battlers_window.index += 1
- @battlers_window.index = 0 if @battlers_window.index > 3
- refresh
- elsif Input.trigger?(Input::C)
- id = @battlers_window.item
- if id != 0 and $game_party.fixed_members.include?($game_actors[id])
- Sound.play_buzzer
- return
- end
- if @battlers_window.selected_index == nil
- Sound.play_decision
- @battlers_window.selected_index = @battlers_window.index
- @battlers_window.draw_item(@battlers_window.index)
- @battlers_window.active = false
- @actors_window.active = true
- @actors_window.index = @last_actor_index
- @status_window.refresh(@actors_window.item)
- else
- Sound.play_equip
- actor_id = @battlers_window.item
- temp_id = @battlers_window.selected_item
- $game_party.battlers[@battlers_window.index] = temp_id
- $game_party.battlers[@battlers_window.selected_index] = actor_id
- @battlers_window.selected_index = nil
- refresh
- end
- elsif Input.trigger?(Input::DOWN) and @battlers_window.selected_index == nil
- Sound.play_cursor
- @battlers_window.active = false
- @battlers_window.index = -1
- @actors_window.active = true
- @actors_window.index = @last_actor_index
- @status_window.refresh(@actors_window.item)
- end
- end
- #--------------------------------------------------------------------------
- # update_actors_window
- #--------------------------------------------------------------------------
- def update_actors_window
- @help_window.refresh(2) if @help_window.type != 2
- if @last_actor_index != @actors_window.index
- @last_actor_index = @actors_window.index
- @status_window.refresh(@actors_window.item)
- end
- if Input.trigger?(Input::B)
- Sound.play_cancel
- if @actors_window.selected_index != nil
- @actors_window.selected_index = nil
- @actors_window.refresh
- else
- @battlers_window.active = true
- @actors_window.active = false
- @battlers_window.index = @last_battler_index
- @battlers_window.selected_index = nil
- @battlers_window.draw_item(@battlers_window.index)
- @status_window.refresh(@battlers_window.item)
- end
- elsif Input.repeat?(Input::UP) and @actors_window.selected_index == nil and
- @actors_window.index == 0 and @battlers_window.selected_index == nil
- Sound.play_cursor
- @battlers_window.active = true
- @actors_window.active = false
- @battlers_window.index = @last_battler_index
- @battlers_window.selected_index = nil
- @battlers_window.draw_item(@battlers_window.index)
- @status_window.refresh(@battlers_window.item)
- elsif Input.trigger?(Input::A) and @actors_window.selected_index == nil
- Sound.play_decision
- @assort_window.active = true
- @assort_window.visible = true
- @assort_back.visible = true
- @actors_window.active = false
- @status_window.visible = false
- elsif Input.trigger?(Input::X)
- Sound.play_equip
- $game_party.actors = @original_order.clone
- refresh
- elsif Input.trigger?(Input::C)
- actor_id = @actors_window.item
- if @battlers_window.selected_index != nil
- Sound.play_equip
- if $game_party.battlers.include?(actor_id) and actor_id != 0
- ix = $game_party.battlers.index(actor_id)
- jx = @battlers_window.selected_index
- $game_party.battlers[ix] = $game_party.battlers[jx]
- end
- $game_party.battlers[@battlers_window.selected_index] = actor_id
- @battlers_window.selected_index = nil
- @battlers_window.active = true
- @actors_window.active = false
- @battlers_window.index = @last_battler_index
- refresh
- elsif @actors_window.selected_index == nil and actor_id > 0
- Sound.play_equip
- @actors_window.selected_index = @actors_window.index
- @actors_window.refresh
- elsif actor_id > 0
- Sound.play_equip
- ix = $game_party.actors.index(actor_id)
- jx = @actors_window.selected_index
- $game_party.actors[ix] = $game_party.actors[jx]
- $game_party.actors[@actors_window.selected_index] = actor_id
- @actors_window.selected_index = nil
- @actors_window.refresh
- @status_window.refresh(@actors_window.item)
- end
- end
- @actors_window.update
- end
- #--------------------------------------------------------------------------
- # update_assort_window
- #--------------------------------------------------------------------------
- def update_assort_window
- @assort_window.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @assort_window.active = false
- @assort_window.visible = false
- @assort_back.visible = false
- @actors_window.active = true
- @status_window.visible = true
- elsif Input.trigger?(Input::C) or Input.trigger?(Input::A)
- if Input.trigger?(Input::C)
- @assort_window.active = false
- @assort_window.visible = false
- @assort_back.visible = false
- @actors_window.active = true
- @status_window.visible = true
- end
- Sound.play_equip
- #---
- result = $game_party.all_members
- case @assort_window.command
- when :story
- priority = []
- for id in YEZ::PARTY::STORY_SORTING_LIST
- priority.push($game_actors[id]) if $game_party.actors.include?(id)
- end
- priority.sort! { |a,b| a.id <=> b.id }
- result = (priority + result).uniq
- when :name; result.sort! { |a,b| a.name <=> b.name }
- when :class; result.sort! { |a,b| a.class.name <=> b.class.name }
- when :level; result.sort! { |a,b| b.level <=> a.level }
- when :hp; result.sort! { |a,b| b.maxhp <=> a.maxhp }
- when :mp; result.sort! { |a,b| b.maxhp <=> a.maxhp }
- when :atk; result.sort! { |a,b| b.atk <=> a.atk }
- when :def; result.sort! { |a,b| b.def <=> a.def }
- when :spi; result.sort! { |a,b| b.spi <=> a.spi }
- when :res; result.sort! { |a,b| b.res <=> a.res }
- when :dex; result.sort! { |a,b| b.dex <=> a.dex }
- when :agi; result.sort! { |a,b| b.agi <=> a.agi }
- when :hit; result.sort! { |a,b| b.hit <=> a.hit }
- when :eva; result.sort! { |a,b| b.eva <=> a.eva }
- when :cri; result.sort! { |a,b| b.cri <=> a.cri }
- when :dur; result.sort! { |a,b| b.max_dur <=> a.max_dur }
- when :luk; result.sort! { |a,b| b.luk <=> a.luk }
- when :odds; result.sort! { |a,b| b.odds <=> a.odds }
- end
- #---
- $game_party.actors = []
- for actor in result
- next if actor == nil
- next if $game_party.actors.include?(actor.id)
- $game_party.actors.push(actor.id)
- end
- refresh
- @status_window.refresh(@actors_window.item)
- end
- end
- end # Scene_Party
- #==============================================================================
- # Window_Command (imported from KGC)
- #==============================================================================
- class Window_Command < Window_Selectable
- unless method_defined?(:add_command)
- #--------------------------------------------------------------------------
- # add command
- #--------------------------------------------------------------------------
- def add_command(command)
- @commands << command
- @item_max = @commands.size
- item_index = @item_max - 1
- refresh_command
- draw_item(item_index)
- return item_index
- end
- #--------------------------------------------------------------------------
- # refresh command
- #--------------------------------------------------------------------------
- def refresh_command
- buf = self.contents.clone
- self.height = [self.height, row_max * WLH + 32].max
- create_contents
- self.contents.blt(0, 0, buf, buf.rect)
- buf.dispose
- end
- #--------------------------------------------------------------------------
- # insert command
- #--------------------------------------------------------------------------
- def insert_command(index, command)
- @commands.insert(index, command)
- @item_max = @commands.size
- refresh_command
- refresh
- end
- #--------------------------------------------------------------------------
- # remove command
- #--------------------------------------------------------------------------
- def remove_command(command)
- @commands.delete(command)
- @item_max = @commands.size
- refresh
- end
- end
- end
- #===============================================================================
- # Window_Command_Centered
- #===============================================================================
- class Window_Command_Centered < Window_Command
- #--------------------------------------------------------------------------
- # draw_item
- #--------------------------------------------------------------------------
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(rect, @commands[index], 1)
- end
- end # Window_Command_Centered
- #===============================================================================
- # Window_SaveFile
- #===============================================================================
- class Window_SaveFile < Window_Base
- #--------------------------------------------------------------------------
- # alias method: draw_playtime
- #--------------------------------------------------------------------------
- alias draw_playtime_pss draw_playtime unless $@
- def draw_playtime(x, y, width, align)
- draw_playtime_pss(x, 0, width, align)
- end
- end # Window_SaveFile
- #==============================================================================
- # Window_MenuStatus
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # overwrite method: refresh
- #--------------------------------------------------------------------------
- def refresh
- @item_max = $game_party.members.size
- create_contents
- colour_non_battler_background
- for i in 0..$game_party.members.size
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # overwrite method: create_contents
- #--------------------------------------------------------------------------
- def create_contents
- self.contents.dispose
- self.contents = Bitmap.new(width - 32, [height - 32, row_max * 96].max)
- self.contents.font.color = normal_color
- end
- #--------------------------------------------------------------------------
- # draw_item
- #--------------------------------------------------------------------------
- def draw_item(index)
- actor = $game_party.members[index]
- return if actor == nil
- draw_actor_face(actor, 2, index * 96 + 2, 92)
- x = 104
- y = index * 96
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x + 120, y)
- draw_actor_level(actor, x, y + WLH * 1)
- draw_actor_state(actor, x, y + WLH * 2)
- draw_stun_indicator(x, y + WLH * 3, actor) if $imported["ClassStatDUR"]
- draw_actor_hp(actor, x + 120, y + WLH * 1, 120)
- draw_actor_mp(actor, x + 120, y + WLH * 2, 120)
- draw_menu_exp(actor, x + 120, y + WLH * 3, 120)
- end
- #--------------------------------------------------------------------------
- # new method: draw_menu_exp
- #--------------------------------------------------------------------------
- def draw_menu_exp(actor, x, y, size = 120)
- if actor.next_exp != 0
- gw = size * actor.now_exp
- gw /= actor.next_exp
- else
- gw = size
- end
- gc1 = text_color(YEZ::PARTY::EXP_GAUGE_1)
- gc2 = text_color(YEZ::PARTY::EXP_GAUGE_2)
- self.contents.fill_rect(x, y + WLH - 8, size, 6, gauge_back_color)
- self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 40, WLH, YEZ::PARTY::EXP_TEXT)
- self.contents.font.color = normal_color
- if actor.next_exp != 0
- expercent = actor.now_exp * 100.0
- expercent /= actor.next_exp
- else
- expercent = 100.0
- end
- expercent = 100.0 if expercent > 100.0
- text = sprintf(YEZ::PARTY::PERCENT_EXP, expercent)
- self.contents.draw_text(x, y, size, WLH, text, 2)
- end
- #--------------------------------------------------------------------------
- # new method: colour_non_battler_background
- #--------------------------------------------------------------------------
- def colour_non_battler_background
- color = Color.new(0, 0, 0, YEZ::PARTY::BACK_OPACITY)
- dy = $game_party.battle_members.size * 96
- dh = $game_party.reserve_members.size * 96
- self.contents.fill_rect(0, dy, self.width - 32, dh, color) if dh > 0
- end
- #--------------------------------------------------------------------------
- # overwrite method: top_row
- #--------------------------------------------------------------------------
- def top_row; return self.oy / 96; end
- #--------------------------------------------------------------------------
- # overwrite method: top_row=
- #--------------------------------------------------------------------------
- def top_row=(row); super(row); self.oy = self.oy / WLH * 96; end
- #--------------------------------------------------------------------------
- # overwrite method: page_row_max
- #--------------------------------------------------------------------------
- def page_row_max; return (self.height - 32) / 96; end
- #--------------------------------------------------------------------------
- # overwrite method: item_rect
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = super(index)
- rect.height = 96
- rect.y = index / @column_max * 96
- return rect
- end
- #--------------------------------------------------------------------------
- # overwrite method: update_cursor
- #--------------------------------------------------------------------------
- def update_cursor
- if @index < 0
- self.cursor_rect.empty
- elsif @index < @item_max
- super
- elsif @index >= 100
- self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
- else
- self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
- end
- end
- end # Window_MenuStatus
- #===============================================================================
- # Window_PartyBattlers
- #===============================================================================
- class Window_PartyBattlers < Window_Selectable
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :selected_index
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 416, 128)
- @column_max = 4
- @spacing = 0
- refresh
- self.index = 0
- self.active = true
- end
- #--------------------------------------------------------------------------
- # new method: item
- #--------------------------------------------------------------------------
- def item; return @data[self.index]; end
- #--------------------------------------------------------------------------
- # new method: selected_item
- #--------------------------------------------------------------------------
- def selected_item; return @data[@selected_index]; end
- #--------------------------------------------------------------------------
- # overwrite method: create_contents
- #--------------------------------------------------------------------------
- def create_contents
- self.contents.dispose
- self.contents = Bitmap.new(width - 32, [height - 32, row_max * 96].max)
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- $game_party.battle_members if $game_party.battlers == nil
- @data = []
- for id in $game_party.battlers; @data.push(id); end
- @item_max = @data.size
- create_contents
- for i in 0..(@item_max-1); draw_item(i); end
- end
- #--------------------------------------------------------------------------
- # draw_item
- #--------------------------------------------------------------------------
- def draw_item(index)
- actor = $game_actors[@data[index]]
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- if actor == nil
- color = Color.new(0, 0, 0, YEZ::PARTY::BACK_OPACITY)
- self.contents.fill_rect(rect.x+2, rect.y+2, rect.width-4, rect.height-4, color)
- if @selected_index != nil and @selected_index == index
- self.contents.font.color = text_color(YEZ::PARTY::ACTIVE_COLOUR)
- else
- self.contents.font.color = system_color
- end
- text = YEZ::PARTY::VOCAB[:empty]
- self.contents.draw_text(rect.x, WLH*3/2, rect.width, WLH, text, 1)
- return
- end
- draw_actor_face(actor, rect.x+2, rect.y+2, 92)
- draw_actor_name(actor, rect.x, rect.y)
- if $game_party.fixed_members.include?(actor)
- draw_icon(YEZ::PARTY::LOCKED_ICON, rect.x, rect.y + WLH*3)
- end
- end
- #--------------------------------------------------------------------------
- # draw_actor_face
- #--------------------------------------------------------------------------
- def draw_actor_face(actor, x, y, size = 96)
- opacity = YEZ::PARTY::FACE_OPACITY
- face_name = actor.face_name
- face_index = actor.face_index
- bitmap = Cache.face(face_name)
- rect = Rect.new(0, 0, 0, 0)
- rect.x = face_index % 4 * 96 + (96 - size) / 2
- rect.y = face_index / 4 * 96 + (96 - size) / 2
- rect.width = size
- rect.height = size
- self.contents.blt(x, y, bitmap, rect, opacity)
- bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # draw_actor_name
- #--------------------------------------------------------------------------
- def draw_actor_name(actor, dx, dy)
- dx += 4; dw = 88
- if @selected_index != nil and @selected_index == actor.index
- self.contents.font.color = text_color(YEZ::PARTY::ACTIVE_COLOUR)
- else
- self.contents.font.color = hp_color(actor)
- end
- self.contents.draw_text(dx, dy, dw, WLH, actor.name, 0)
- end
- #--------------------------------------------------------------------------
- # overwrite method: top_row
- #--------------------------------------------------------------------------
- def top_row; return self.oy / 96; end
- #--------------------------------------------------------------------------
- # overwrite method: top_row=
- #--------------------------------------------------------------------------
- def top_row=(row); super(row); self.oy = self.oy / WLH * 96; end
- #--------------------------------------------------------------------------
- # overwrite method: page_row_max
- #--------------------------------------------------------------------------
- def page_row_max; return (self.height - 32) / 96; end
- #--------------------------------------------------------------------------
- # overwrite method: item_rect
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new(0, 0, 96, 96)
- rect.x = index % @column_max * (rect.width + @spacing)
- rect.y = index / @column_max * 96
- return rect
- end
- #--------------------------------------------------------------------------
- # overwrite method: update_cursor
- #--------------------------------------------------------------------------
- def update_cursor
- if @index < 0
- self.cursor_rect.empty
- elsif @index < @item_max
- super
- elsif @index >= 100
- self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
- else
- self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
- end
- end
- end # Window_PartyBattlers
- #===============================================================================
- # Window_PartyActors
- #===============================================================================
- class Window_PartyActors < Window_Selectable
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :selected_index
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0, 128, 160, 288)
- self.index = -1
- refresh
- end
- #--------------------------------------------------------------------------
- # new method: item
- #--------------------------------------------------------------------------
- def item; return @data[self.index]; end
- #--------------------------------------------------------------------------
- # new method: selected_item
- #--------------------------------------------------------------------------
- def selected_item; return @data[@selected_index]; end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- for actor in $game_party.all_members; @data.push(actor.id); end
- @data = @data + [0]
- @item_max = @data.size
- create_contents
- for i in 0..(@item_max-1); draw_item(i); end
- end
- #--------------------------------------------------------------------------
- # draw_item
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- actor = $game_actors[@data[index]]
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- if actor == nil
- draw_icon(YEZ::PARTY::CLEAR_ICON, rect.x+6, rect.y)
- rect.x += 32; rect.width -= 34
- text = YEZ::PARTY::VOCAB[:clear]
- self.contents.draw_text(rect.x, rect.y, rect.width, WLH, text)
- return
- end
- offset = YEZ::PARTY::SPRITE_OFFSET
- draw_actor_graphic(actor, rect.x + 16, rect.y + rect.height + offset)
- rect.x += 32
- rect.width -= 34
- self.contents.font.color = hp_color(actor)
- enabled = !$game_party.battle_members.include?(actor)
- self.contents.font.color.alpha = enabled ? 255 : 128
- if @selected_index != nil and @selected_index == index
- self.contents.font.color = text_color(YEZ::PARTY::ACTIVE_COLOUR)
- end
- self.contents.draw_text(rect.x, rect.y, rect.width, WLH, actor.name)
- end
- end # Window_PartyActors
- #===============================================================================
- # Window_PartyHelp
- #===============================================================================
- class Window_PartyHelp < Window_Base
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :type
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- super(416, 0, 128, 128)
- refresh
- end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh(type = 1)
- self.contents.clear
- @type = type
- vocab = YEZ::PARTY::VOCAB
- keys = YEZ::PARTY::KEYS
- buttons = YEZ::ICONS[:buttons] if $imported["Icons"]
- dx = 4; dw = 120
- if @type == 1
- text1 = vocab[:c_battler]
- text2 = vocab[:b_battler]
- text3 = vocab[:a_battler]
- text4 = vocab[:x_battler]
- if $imported["Icons"]
- draw_icon(buttons[:c], 0, WLH*0)
- draw_icon(buttons[:b], 0, WLH*1)
- draw_icon(buttons[:a], 0, WLH*2)
- draw_icon(buttons[:x], 0, WLH*3)
- dx = 24; dw = 100
- else
- text1 = sprintf(keys[:c], text1)
- text2 = sprintf(keys[:b], text2)
- text3 = sprintf(keys[:a], text3)
- text4 = sprintf(keys[:x], text4)
- end
- elsif @type == 2
- text1 = vocab[:c_actors]
- text2 = vocab[:b_actors]
- text3 = vocab[:a_actors]
- text4 = vocab[:x_actors]
- if $imported["Icons"]
- draw_icon(buttons[:c], 0, WLH*0)
- draw_icon(buttons[:b], 0, WLH*1)
- draw_icon(buttons[:a], 0, WLH*2)
- draw_icon(buttons[:x], 0, WLH*3)
- dx = 24; dw = 100
- else
- text1 = sprintf(keys[:c], text1)
- text2 = sprintf(keys[:b], text2)
- text3 = sprintf(keys[:a], text3)
- text4 = sprintf(keys[:x], text4)
- end
- end
- self.contents.draw_text(dx, WLH*0, dw, WLH, text1)
- self.contents.draw_text(dx, WLH*1, dw, WLH, text2)
- self.contents.draw_text(dx, WLH*2, dw, WLH, text3)
- self.contents.draw_text(dx, WLH*3, dw, WLH, text4)
- end
- end # Window_PartyHelp
- #===============================================================================
- # Window_PartyStatus
- #===============================================================================
- class Window_PartyStatus < Window_Base
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- super(160, 128, 384, 288)
- end
- #--------------------------------------------------------------------------
- # item
- #--------------------------------------------------------------------------
- def item; return @actor; end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh(actor_id)
- self.contents.clear
- if actor_id <= 0
- color = Color.new(0, 0, 0, YEZ::PARTY::BACK_OPACITY)
- self.contents.fill_rect(0, 0, self.width, self.height, color)
- self.contents.font.color = system_color
- text = YEZ::PARTY::VOCAB[:nodata]
- self.contents.draw_text(0, self.height/2-24, self.width-40, WLH, text, 1)
- return
- end
- actor = $game_actors[actor_id]
- @actor = actor
- draw_actor_face(actor, 0, 0, size = 96)
- x = 104
- y = 0
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x + 120, y)
- draw_actor_level(actor, x, y + WLH * 1)
- draw_actor_state(actor, x, y + WLH * 2)
- draw_stun_indicator(x, y + WLH * 3, actor) if $imported["ClassStatDUR"]
- draw_actor_hp(actor, x + 120, y + WLH * 1, 120)
- draw_actor_mp(actor, x + 120, y + WLH * 2, 120)
- draw_actor_exp(actor, x + 120, y + WLH * 3, 120)
- draw_actor_stats(actor, 0, y + WLH * 9/2)
- end
- #--------------------------------------------------------------------------
- # draw_actor_exp
- #--------------------------------------------------------------------------
- def draw_actor_exp(actor, x, y, size = 120)
- if actor.next_exp != 0
- gw = size * actor.now_exp
- gw /= actor.next_exp
- else
- gw = size
- end
- gc1 = text_color(YEZ::PARTY::EXP_GAUGE_1)
- gc2 = text_color(YEZ::PARTY::EXP_GAUGE_2)
- self.contents.fill_rect(x, y + WLH - 8, size, 6, gauge_back_color)
- self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 40, WLH, YEZ::PARTY::EXP_TEXT)
- self.contents.font.color = normal_color
- if actor.next_exp != 0
- expercent = actor.now_exp * 100.0
- expercent /= actor.next_exp
- else
- expercent = 100.0
- end
- expercent = 100.0 if expercent > 100.0
- text = sprintf(YEZ::PARTY::PERCENT_EXP, expercent)
- self.contents.draw_text(x, y, size, WLH, text, 2)
- end
- #--------------------------------------------------------------------------
- # draw_actor_stats
- #--------------------------------------------------------------------------
- def draw_actor_stats(actor, dx, dy)
- fx = dx; fy = dy
- cw = calc_width
- for stat in YEZ::PARTY::SHOWN_STATS
- icon = 0; up_icon = YEZ::PARTY::UP_ICON; dn_icon = YEZ::PARTY::DN_ICON
- case stat
- when :atk
- up_icon = YEZ::ICONS[:upatk] if $imported["Icons"]
- dp_icon = YEZ::ICONS[:dnatk] if $imported["Icons"]
- icon = $imported["Icons"] ? YEZ::ICONS[:atk] : 0
- icon = up_icon if actor.atk > actor.base_atk
- icon = dn_icon if actor.atk < actor.base_atk
- name = Vocab.atk
- value = actor.atk
- when :def
- up_icon = YEZ::ICONS[:updef] if $imported["Icons"]
- dp_icon = YEZ::ICONS[:dndef] if $imported["Icons"]
- icon = $imported["Icons"] ? YEZ::ICONS[:def] : 0
- icon = up_icon if actor.def > actor.base_def
- icon = dn_icon if actor.def < actor.base_def
- name = Vocab.def
- value = actor.def
- when :spi
- up_icon = YEZ::ICONS[:upspi] if $imported["Icons"]
- dp_icon = YEZ::ICONS[:dnspi] if $imported["Icons"]
- icon = $imported["Icons"] ? YEZ::ICONS[:spi] : 0
- icon = up_icon if actor.spi > actor.base_spi
- icon = dn_icon if actor.spi < actor.base_spi
- name = Vocab.spi
- value = actor.spi
- when :agi
- up_icon = YEZ::ICONS[:upagi] if $imported["Icons"]
- dp_icon = YEZ::ICONS[:dnagi] if $imported["Icons"]
- icon = $imported["Icons"] ? YEZ::ICONS[:agi] : 0
- icon = up_icon if actor.agi > actor.base_agi
- icon = dn_icon if actor.agi < actor.base_agi
- name = Vocab.agi
- value = actor.agi
- when :hit
- icon = $imported["Icons"] ? YEZ::ICONS[:hit] : 0
- value = sprintf("%d%%",[[actor.hit, 0].max, 99].min)
- name = Vocab.hit
- when :eva
- icon = $imported["Icons"] ? YEZ::ICONS[:eva] : 0
- value = sprintf("%d%%",[[actor.eva, 0].max, 99].min)
- name = Vocab.eva
- when :cri
- icon = $imported["Icons"] ? YEZ::ICONS[:cri] : 0
- value = sprintf("%d%%",[[actor.cri, 0].max, 99].min)
- name = Vocab.cri
- when :odds
- icon = $imported["Icons"] ? YEZ::ICONS[:odds] : 0
- value = actor.odds
- name = Vocab.odds
- when :res
- next unless $imported["BattlerStatRES"]
- up_icon = YEZ::ICONS[:upres] if $imported["Icons"]
- dp_icon = YEZ::ICONS[:dnres] if $imported["Icons"]
- icon = $imported["Icons"] ? YEZ::ICONS[:res] : 0
- icon = up_icon if actor.res > actor.base_res
- icon = dn_icon if actor.res < actor.base_res
- value = actor.res
- name = Vocab.res
- when :dex
- next unless $imported["BattlerStatDEX"]
- up_icon = YEZ::ICONS[:updex] if $imported["Icons"]
- dp_icon = YEZ::ICONS[:dndex] if $imported["Icons"]
- icon = $imported["Icons"] ? YEZ::ICONS[:dex] : 0
- icon = up_icon if actor.dex > actor.base_dex
- icon = dn_icon if actor.dex < actor.base_dex
- value = actor.dex
- name = Vocab.dex
- when :luk
- next unless $imported["ClassStatLUK"]
- up_icon = YEZ::ICONS[:upluk] if $imported["Icons"]
- dp_icon = YEZ::ICONS[:dnluk] if $imported["Icons"]
- icon = $imported["Icons"] ? YEZ::ICONS[:luk] : 0
- icon = up_icon if actor.luk > actor.base_luk
- icon = dn_icon if actor.luk < actor.base_luk
- value = actor.luk
- name = Vocab.luk
- when :dur
- next unless $imported["ClassStatDUR"]
- icon = $imported["Icons"] ? YEZ::ICONS[:dur] : 0
- value = actor.max_dur
- name = Vocab.dur
- else; next
- end
- draw_icon(icon, dx, dy)
- self.contents.font.color = system_color
- self.contents.draw_text(dx+24, dy, 60, WLH, name, 0)
- self.contents.font.color = normal_color
- self.contents.draw_text(dx+84, dy, cw, WLH, value, 2)
- dx = dx == fx ? dx + (self.width-32)/2 : fx
- dy = dx == fx ? dy + WLH : dy
- break if dy + 24 > self.height - 32
- end
- end
- #--------------------------------------------------------------------------
- # calc_width
- #--------------------------------------------------------------------------
- def calc_width
- return @calc_width if @calc_width != nil
- n = 0
- for actor in $game_party.members
- for item in YEZ::PARTY::SHOWN_STATS
- text = ""
- case item
- when :atk; text = actor.atk
- when :def; text = actor.def
- when :spi; text = actor.spi
- when :agi; text = actor.agi
- when :res; text = actor.res if $imported["BattlerStatRES"]
- when :dex; text = actor.dex if $imported["BattlerStatDEX"]
- when :hit; text = sprintf("%d%%", [[actor.hit, 0].max, 99].min)
- when :eva; text = sprintf("%d%%", [[actor.eva, 0].max, 99].min)
- when :cri; text = sprintf("%d%%", [[actor.cri, 0].max, 99].min)
- when :dur; text = actor.dur if $imported["ClassStatDUR"]
- when :luk; text = actor.luk if $imported["BattlerStatLUK"]
- when :odds; text = actor.odds
- else; next
- end
- n = [n, contents.text_size(text).width].max
- end
- end
- @calc_width = n
- return n
- end
- end # Window_PartyStatus
- #===============================================================================
- # Window_PartyAssort
- #===============================================================================
- class Window_PartyAssort < Window_Selectable
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- super(160, 164, 384, 264)
- @column_max = 2
- @spacing = 0
- self.opacity = 0
- self.index = 0
- self.visible = false
- self.active = false
- refresh
- end
- #--------------------------------------------------------------------------
- # command
- #--------------------------------------------------------------------------
- def command; return @data[self.index]; end
- #--------------------------------------------------------------------------
- # refresh
- #--------------------------------------------------------------------------
- def refresh
- @data = []; @vocab = []
- for command in YEZ::PARTY::ASSORT_COMMANDS
- case command
- when :story, :name, :class, :level; @vocab.push(YEZ::PARTY::VOCAB[command])
- when :hp; @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.hp))
- when :mp; @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.mp))
- when :atk; @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.atk))
- when :def; @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.def))
- when :spi; @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.spi))
- when :agi; @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.agi))
- when :hit; @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.hit))
- when :eva; @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.eva))
- when :cri; @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.cri))
- when :odds; @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.odds))
- when :res
- next unless $imported["BattlerStatRES"]
- @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.res))
- when :dex
- next unless $imported["BattlerStatDEX"]
- @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.dex))
- when :dur
- next unless $imported["ClassStatDUR"]
- @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.dur))
- when :luk
- next unless $imported["ClassStatLUK"]
- @vocab.push(sprintf(YEZ::PARTY::VOCAB[:stat], Vocab.luk))
- else; next
- end
- @data.push(command)
- end
- @item_max = @data.size
- create_contents
- for i in 0..(@item_max-1); draw_item(i); end
- end
- #--------------------------------------------------------------------------
- # draw_item
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- text = @vocab[index]
- return if text == nil
- icon = YEZ::PARTY::CLEAR_ICON
- if $imported["Icons"] and YEZ::ICONS.include?(@data[index])
- icon = YEZ::ICONS[@data[index]]
- end
- draw_icon(icon, rect.x, rect.y)
- rect.x += 24
- rect.width -= 28
- self.contents.draw_text(rect, text, 0)
- end
- end # Window_PartyAssort
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement