Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # ■ ACE Skill System [RMXP]
- # ■ Author: Bigace360
- # ■ Version: 1.00
- # ■ Date: January 21, 2013
- # ■ Blog: http://bigaceworld.wordpress.com/
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # VERSION HISTORY #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # 01.21.2013 (v1.00) - Finished Script
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # INTRODUCTION #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # This script does not rework the way skills function. This script only reworks
- # the way the Skill Scene appears and what it can be used for. Basically
- # functions as a bridge inbetween many ACE scripts in addition to making all of
- # the skill-related ACE scripts accessible from one common place. Menu searching
- # and surfing can become quite annoying for the player and this script's main
- # purpose is to minimize that annoyance.
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # INSTRUCTIONS #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below Scene_Debug, and Warrior_Engine, but above Main.
- #
- # Scroll down and edit the module as you see fitting for your game.
- #
- # -----------------------------------------------------------------------------
- # Debug Shortcuts - Only during $DEBUG and $BTEST mode
- # -----------------------------------------------------------------------------
- # During testplay mode, pressing F5 during the command window selection process
- # or the skill selection process will recover all of the actor's SP.
- #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # SECTIONS #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # ■ Game_Objects
- # ** ACE Module
- # ** RPG Module
- # ** Bitmap
- # ** Numeric
- # ** Game_Temp
- # ** Game_Battler
- # ** Game_Actor
- # ** Game_Party
- #
- # ■ Windows
- # ** Window_Base
- # ** Window_Selectable
- # ** Window_Skill
- # ** Window_SkillStatus
- # ** Window_Command_Base
- # ** Window_SkillCommand
- #
- # ■ Scenes
- # ** Scene_Base
- # ** Scene_Skill
- # ** Scene_Battle
- #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- #
- # Credits/Thanks:
- # - Bigace360, for the script.
- #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # Script Conflicts and Compatability #
- #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
- # Compatibility
- # Requires Scene_Base v1.2
- # Requires Module RPG::BaseItem [RMXP]
- #
- # ● Alias methods
- # class Game_Actor
- # def initialize(*args)
- #
- # class Game_Party
- # def initialize
- #
- # ● Overwrite methods
- # class Game_Battler
- # def skill_can_use?
- #
- # class Window_Skill
- # Has been completely overwritten. Expect no functionality with any scripts
- # that will also replace Window_Skill.
- #
- # class Window_SkillStatus
- # Has been completely overwritten. Expect no functionality with any scripts
- # that will also replace Window_SkillStatus.
- #
- # class Scene_Skill
- # Has been completely overwritten. Expect no functionality with any scripts
- # that will also replace Scene_Skill.
- #
- # class Scene_Battle
- # def start_skill_select
- #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- #
- #=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Module ACE::SKILL_SYSTEM
- #=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- module ACE
- #=============================================================================
- # ▼ Warning DO NOT TOUCH THIS MODULE, altering this will ruin any chances of
- # any script that requires this engine to run.
- #
- # For Configurations go to Module SKILL_SYSTEM below this one.
- #=============================================================================
- module CORE
- def self.required_script(name, req, version, type = 0)
- if type != :bellow && (!$ace_script[req] || $ace_script[req] < version)
- msg = "The script '%s' requires the script\n"
- case type
- when :above then msg += "'%s' v%s or higher above it to work properly\n"
- else msg += "'%s' v%s or higher to work properly\n"
- end
- msg += "Go to http://bigaceworld.wordpress.com/ to download this script."
- self.exit_message(msg, name, req, version)
- elsif type == :bellow && $ace_script[req]
- msg = "The script '%s' requires the script\n"
- msg += "'%s' to be put bellow it\n"
- msg += "move the scripts to the proper position"
- self.exit_message(msg, name, req, version)
- end
- end
- def self.exit_message(message, name, req, version)
- name = self.script_name(name)
- req = self.script_name(req)
- msgbox(sprintf(message, name, req, version))
- exit
- end
- def self.script_name(name, ext = "Skill Base")
- name = name.to_s.gsub("_", " ").upcase.split
- name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
- name.join(" ")
- end
- end
- #=============================================================================
- # ▼ BEGIN CONFIGURATIONS HERE BELOW
- #=============================================================================
- module SKILL_SYSTEM
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ◆ Section I. General Menu Settings ◆
- # -------------------------------------------------------------------------
- # This changes the way Menus appear in your game. You can change their
- # alignment, and the location of the help window, Note that any non-ACE
- # System scripts may not conform to these Menu styles.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- SKILL_CONFIG ={
- # :skill_win - [Opacity, Window Border?]. (Opacity Limit: 0~255)
- :skill_win => [200, false],
- # :background - Background images
- :background => 'back04',
- # :fx - Back FX (0=Moving/ 1=Still/ 2=Map)
- :fx => 0,
- # :tran_time - Transition Time.
- :tran_time => 10,
- # :tran_type - Transition Type (Name)
- :tran_type => '004-Blind04',
- # :menu_index - If :menu_access is true, then this value determines where
- # in the menu command window it is inserted.
- :menu_index => 1,
- # :layout - Image filename for window layout, must be in the Menu folder
- :layout => '',
- }
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ◆ Section II. Skill Menu Settings ◆
- # -------------------------------------------------------------------------
- # This array adjusts what options appear in the initial skill command
- # window. Add commands, remove commands, or rearrange them. Here's a list
- # of which does what:
- #
- # -------------------------------------------------------------------------
- # :command Description
- # -------------------------------------------------------------------------
- # :view_skills | View all of the available skills usable by the actor.
- #
- # :materia | Requires Sephiroth's Materia System
- #
- # And that's all of the currently available commands. This list will be
- # updated as more scripts become available.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- SKILL_COMMANDS =[
- [:view_skills, 'View Skill'],
- [:materia, 'Materia'], # Requires Sephiroth's Materia System
- #[:custom1, 'Custom Name'] # Custom Skill Command 1
- #[:custom2, 'Custom Text'] # Custom Skill Command 2
- ] # Do not remove this.
- SKILL_DESCRIPTIONS ={
- :view_skills => 'View the actor\'s abilities.',
- :materia => 'Attach ‘materias’ on the actor equipment to gain skills and other effects.',
- #:custom1 => 'Custom Skill Command 1',
- #:custom2 => 'Custom Skill Command 2',
- } # Do not remove this.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ◆ Section III. Skill Custom Settings ◆
- # -------------------------------------------------------------------------
- # For those who use scripts to that may produce unique effects for
- # equipping, use this hash to manage the custom commands for the Skill
- # Command Window. You can disable certain commands or prevent them from
- # appearing by using switches. If you don't wish to bind them to a switch,
- # set the proper switch to 0 for it to have no impact.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- CUSTOM_SKILL_COMMANDS ={
- # :command => [HideSw, DisbSw, Scene],
- :materia => [ 0, 1, "Scene_MateriaEquip"],
- :custom1 => [ 0, 0, ""],
- :custom2 => [ 0, 0, ""],
- } # Do not remove this.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # ◆ Section III. Item Status Settings ◆
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # The item status window displays information about the item in detail.
- # Adjust the settings below to change the way the status window appears.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- MAX_ICONS_DRAWN = 7 # 7: Maximum number of icons drawn for states.
- # The following adjusts the vocabulary used for the status window. Each
- # of the vocabulary settings are self explanatory.
- VOCAB_STATUS ={
- :empty => "---", # Text used when nothing is shown.
- :cost => "Cost", # Text usde for skill cost.
- :scope => "Scope", # Text used for skill target area of influence.
- :power => "Power", # Text used for attack power.
- :element => "Elements", # Text used for element attributes.
- :applies => "Applies", # Text used for applied states and buffs.
- :removes => "Removes", # Text used for removed states and buffs.
- } # Do not remove this.
- # This is for the status window, use the button input to change between
- # actor and skill status windows. The quotes are for the player to know
- # what they are doing.
- QUOTE ={
- :button => Input::SHIFT,
- :actors => 'Press [%s] to show skill stats',
- :skills => 'Press [%s] to show actors stats',
- }
- end
- end
- #===============================================================================
- # ▼ Editting anything past this point may potentially result in causing
- # computer damage, incontinence, explosion of user's head, coma, death,
- # and/or halitosis so edit at your own risk.
- #===============================================================================
- #
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ▼ Import to Global Hash ▼ #
- ($ace_script ||= {})[:ace_skill_menu] = 1.00
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Bitmap
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Bitmap
- def clear_rect(*args)
- color = Color.new(0, 0, 0, 0)
- args << color
- fill_rect(*args)
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Numeric
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Numeric
- def group; return self.to_s; end unless $ace_script[:ace_warrior_module]
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Game_Temp
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Game_Temp
- attr_accessor(:skill_index, :skill_oy)
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Game_Battler
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Game_Battler
- unless $ace_script[:ace_warrior_module]
- def skill_can_use?(skill_id)
- skill = $data_skills[skill_id]
- return false if skill.sp_cost > self.sp
- return false if dead?
- return false if skill.atk_f == 0 && self.restriction == 1
- $game_temp.in_battle ? skill.battle_ok? : skill.menu_ok?
- end
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Game_Actor
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Game_Actor < Game_Battler
- attr_accessor :last_skill_id # for cursor memory: Skill
- alias :ace_skillbase_initi :initialize unless $@
- def initialize(*args)
- ace_skillbase_initi(*args)
- @last_skill_id = 0
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Game_Party
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Game_Party
- attr_accessor(:last_target_index)
- alias :ace_skillbase_initi :initialize unless $@
- def initialize
- ace_skillbase_initi
- @last_target_index = 0
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_Base
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_Base < Window
- include ACE::SKILL_SYSTEM
- alias :ace_skillbase_initi :initialize unless $@
- def initialize(*args)
- ace_skillbase_initi(*args)
- skill_Opacity?
- end
- def skill_Opacity?
- return unless $scene.is_a?(Scene_Skill)
- self.back_opacity = SKILL_CONFIG[:skill_win][0]
- self.opacity = SKILL_CONFIG[:skill_win][0] if SKILL_CONFIG[:skill_win][1]
- end
- def line_height; return 32; end
- def translucent_alpha; return 160; end
- def standard_padding; return 16; end
- def draw_icon(icon_index, x, y, enabled = true)
- bitmap = RPG::Cache.icon(icon_index)
- self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), enabled ? 255 : translucent_alpha)
- end
- def fitting_height(line_number)
- (line_number * line_height) + (standard_padding * 2)
- end
- def draw_item_name(item, x, y, enabled = true, width = 212)
- return if item.nil?
- draw_icon(item.icon_name, x, y+4, enabled)
- contents.font.color = normal_color
- contents.font.color.alpha = enabled ? 255 : translucent_alpha
- contents.draw_text(x + 25, y, width, 32, item.name)
- end
- def show; self.visible = true; self; end
- def hide; self.visible = false; self; end
- def activate; self.active = true; self; end
- def deactivate; self.active = false; self; end
- def param_change_color(change)
- return Color.new(128,255,128) if change > 0
- return Color.new(192,128,128) if change < 0
- return normal_color
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_Selectable
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_Selectable < Window_Base
- attr_reader :item_max # item count
- def select(index); self.index = index if index; end
- def unselect; self.index = -1; end
- def col_max(n); return @column_max = n; end
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 32)
- rect.width = self.width / @column_max - 32
- rect.x = index % @column_max * (rect.width + 32)
- rect.y = index / @column_max * 32
- return rect
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_Skill
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_Skill < Window_Selectable
- def initialize(x, y, width, height, actor)
- super(x, y, width, height)
- @actor = actor
- col_max(2)
- refresh
- end
- def skill; return @data[self.index]; end
- def refresh
- self.contents.dispose if self.contents != nil
- self.contents = nil if self.contents != nil
- @data = []
- (@actor.skills.size).times do |i|
- skill = $data_skills[@actor.skills[i]]
- @data << skill if !skill.nil?
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- @item_max.times {|i| draw_item(i)}
- end
- end
- def enable?(skill)
- @actor.skill_can_use?(skill.id)
- end
- def draw_item(index)
- rect = item_rect(index)
- contents.clear_rect(rect)
- skill = @data[index]
- return if skill.nil?
- rect.width -= 4
- draw_item_name(skill, rect.x, rect.y, enable?(skill))
- draw_skill_cost(rect, skill)
- end
- unless method_defined?(:draw_skill_cost)
- def draw_skill_cost(rect, skill)
- contents.draw_text(rect, skill.sp_cost.to_s, 2)
- end
- end
- def update_help
- @help_window.set_text(skill.nil? ? '' : skill.description)
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_SkillStatus
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_SkillStatus < Window_Base
- attr_accessor :mode
- def initialize(x, y, width, item_window)
- super(x, y, width, fitting_height(3))
- self.contents = Bitmap.new(width - 32, height - 32)
- @item_window = item_window
- @skill = nil; @actor = nil
- set_mode(0)
- end
- def line_height; return 32; end
- def actor=(actor)
- return if @actor == actor
- @actor = actor
- refresh
- end
- def update; super; update_item(@item_window.skill); end
- def update_item(skill)
- return if ((@skill == skill && @item_window.active) || (!@item_window.active && @skill.nil?))
- @skill = (@item_window.active ? skill : nil)
- refresh
- end
- def set_mode(mode)
- @mode = mode
- refresh
- end
- def refresh
- contents.clear
- reset_font_settings if $ace_script[:ace_warrior_module]
- draw_empty1
- return unless @actor
- draw_actor_simple_face
- case @mode
- when 0
- draw_button(:actors, 108, 23 * 3)
- draw_actor_simple_status
- when 1
- contents.font.size = 17
- draw_button(:skills, 108, 23 * 3)
- @skill.nil? ? draw_empty2 : draw_skill_simple_status
- end
- end
- def draw_empty1
- colour = Color.new(0, 0, 0, translucent_alpha/2)
- rect = Rect.new(1, 1, 94, 94)
- contents.fill_rect(rect, colour)
- end
- def draw_empty2
- dx = 96; dy = 0
- dw = (contents.width - 96) / 2
- 6.times do |i|
- draw_background_box(dx, dy, dw)
- dx = dx >= 96 + dw ? 96 : 96 + dw
- dy += 24 if dx == 96
- end
- end
- def draw_background_box(dx, dy, dw)
- colour = Color.new(0, 0, 0, translucent_alpha/2)
- rect = Rect.new(dx+1, dy+1, dw-2, 24-2)
- contents.fill_rect(rect, colour)
- end
- def draw_button(quote, x, y)
- case QUOTE[:button]
- when Input::SHIFT then button = 'Shift'
- when Input::A then button = 'Z'
- when Input::X then button = 'A'
- when Input::Y then button = 'S'
- when Input::Z then button = 'D'
- else
- print("Sorry, but the button inputs B, C, L, R, UP, DOWN, RIGHT, LEFT, " +
- "F5, 56, F7, F8, or F9 is not allow. " +
- "Please choose A, X, Y, Z, or SHIFT inputs instead for the scene " +
- "changing button.")
- exit
- end
- contents.font.size = Font.default_size; contents.font.color = normal_color
- contents.draw_text(x, y, self.width - 32, 32, sprintf(QUOTE[quote], button))
- end
- def draw_actor_simple_face
- if $ace_script[:ace_warrior_module] && SHOW_FACE
- draw_actor_face(@actor, 0, 0) rescue draw_actor_graphic(@actor, 48, 70)
- else draw_actor_graphic(@actor, 48, 70)
- end
- end
- def draw_actor_simple_status
- dx = 108; dy = 0
- draw_actor_name(@actor, dx, dy)
- draw_actor_level(@actor, dx, dy + 24)
- if $ace_script[:ace_warrior_module]
- draw_actor_state(@actor, dx, dy + 48, 96)
- draw_actor_hp(@actor, dx + 120, dy + 24 * 0, 210)
- draw_actor_sp(@actor, dx + 120, dy + 24 * 1, 210)
- draw_actor_exp(@actor, dx + 120, dy + 24 * 2, 210)
- else
- draw_actor_state(@actor, dx, dy + 48)
- draw_actor_hp(@actor, dx + 120, dy + 24 * 0)
- draw_actor_sp(@actor, dx + 120, dy + 24 * 1)
- draw_actor_exp(@actor, dx + 120, dy + 24 * 2)
- end
- end
- def vocab(index); return VOCAB_STATUS[index]; end
- def draw_skill_simple_status
- dx = 96; dy = 0
- dw = (contents.width - 96) / 2
- draw_skill_cost(dx, dy + 24 * 0, dw)
- draw_skill_power(dx, dy + 24 * 1, dw)
- draw_applies(dx, dy + 24 * 2, dw)
- draw_area_scope(dx + dw, dy + 24 * 0, dw)
- draw_element(dx + dw, dy + 24 * 1, dw)
- draw_removes(dx + dw, dy + 24 * 2, dw)
- end
- def draw_skill_cost(dx, dy, dw)
- draw_background_box(dx, dy, dw)
- contents.font.color = system_color
- rect = Rect.new(dx+4, dy, dw-8, 24)
- contents.draw_text(rect, vocab(:cost))
- contents.font.size = 16
- draw_sp_skill_cost(rect, @skill)
- if $ace_script[:ace_warrior_module]
- draw_tp_skill_cost(rect, @skill) if $ace_script[:tp_system]
- if $ace_script[:cost_manager]
- draw_hp_skill_cost(rect, @skill)
- draw_gold_skill_cost(rect, @skill)
- draw_custom_skill_cost(rect, @skill)
- end
- end
- end
- def enable?(skill)
- @actor.skill_can_use?(skill.id)
- end
- def draw_sp_skill_cost(rect, skill)
- if $ace_script[:ace_warrior_module]
- return unless @actor.calc_sp_cost(skill) > 0
- colour = Color.color_between(Color.blue, Color.normal, 0.7)
- change_color(colour, enable?(skill))
- if $ace_script[:cost_manager]
- icon = Icon.sp_cost
- if !icon.nil?
- draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
- rect.width -= 24
- end
- end
- cost = @actor.calc_sp_cost(skill)
- text = sprintf("%s%s", cost.group, $data_system.words.sp)
- draw_text(rect, text, 2)
- cx = text_size(text).width + 4
- rect.width -= cx
- reset_font_settings
- else
- contents.font.color = normal_color
- contents.draw_text(rect, skill.sp_cost.to_s, 2)
- end
- end
- def draw_tp_skill_cost(rect, skill)
- return unless @actor.skill_tp_cost(skill) > 0
- colour = Color.color_between(Color.green, Color.normal)
- change_color(colour, enable?(skill))
- if $ace_script[:cost_manager]
- icon = Icon.tp_cost
- if !icon.nil?
- draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
- rect.width -= 24
- end
- end
- cost = @actor.skill_tp_cost(skill)
- text = sprintf("%s%s", cost.group, TP_A)
- draw_text(rect, text, 2)
- cx = text_size(text).width + 4
- rect.width -= cx
- reset_font_settings
- end
- def draw_hp_skill_cost(rect, skill)
- return unless @actor.skill_hp_cost(skill) > 0
- change_color(hp_cost_color, enable?(skill))
- icon = Icon.hp_cost
- if !icon.nil?
- draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
- rect.width -= 24
- end
- contents.font.size = HP_SETTINGS[:f_size]
- cost = @actor.skill_hp_cost(skill)
- text = sprintf("%s%s", cost.group, $data_system.words.hp)
- draw_text(rect, text, 2)
- cx = text_size(text).width + 4
- rect.width -= cx
- reset_font_settings
- end
- def draw_gold_skill_cost(rect, skill)
- return unless @actor.skill_gold_cost(skill) > 0
- change_color(gold_cost_color, enable?(skill))
- icon = Icon.gold_cost
- if !icon.nil?
- draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
- rect.width -= 24
- end
- contents.font.size = GOLD_SETTINGS[:f_size]
- cost = @actor.skill_gold_cost(skill)
- text = sprintf("%s%s", cost.group, $data_system.words.gold)
- draw_text(rect, text, 2)
- cx = text_size(text).width + 4
- rect.width -= cx
- reset_font_settings
- end
- def draw_custom_skill_cost(rect, skill)
- return unless skill.use_custom_cost
- change_color(custom_color(skill), enable?(skill))
- icon = custom_cost(skill)
- if !icon.nil?
- draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))
- rect.width -= 24
- end
- contents.font.size = CUSTOM_COST_SETTINGS[skill][2]
- text = CUSTOM_COST_SETTINGS[skill][0]
- draw_text(rect, text, 2)
- cx = text_size(text).width + 4
- rect.width -= cx
- reset_font_settings
- end
- def draw_skill_power(dx, dy, dw)
- draw_background_box(dx, dy, dw)
- contents.font.color = system_color
- contents.draw_text(dx+4, dy, dw-8, 24, vocab(:power))
- contents.font.color = normal_color; contents.font.size = 16
- contents.draw_text(dx+4, dy, dw-8, 24, @skill.power.group, 2)
- end
- def draw_applies(dx, dy, dw)
- draw_background_box(dx, dy, dw)
- contents.font.color = system_color
- contents.draw_text(dx+4, dy, dw-8, 24, vocab(:applies))
- icons = []
- (@skill.plus_state_set).each do |state_id|
- next if $data_states[state_id].nil?
- icons << $data_states[state_id].name
- break if icons.size >= 8
- end
- draw_icons(dx, dy, dw, icons)
- end
- def draw_area_scope(dx, dy, dw)
- draw_background_box(dx, dy, dw)
- contents.font.color = system_color
- contents.draw_text(dx+4, dy, dw-8, 24, vocab(:scope))
- text = case @skill.scope
- when 0 then 'None'
- when 1 then 'One Enemy'
- when 2 then 'All Enemies'
- when 3 then 'One Ally'
- when 4 then 'All Allies'
- when 5 then 'One Dead Ally'
- when 6 then 'All Dead Allies'
- when 7 then 'The User'
- end
- contents.font.color = normal_color; contents.font.size = 16
- contents.draw_text(dx+4, dy, dw-8, 24, text, 2)
- end
- def draw_element(dx, dy, dw)
- draw_background_box(dx, dy, dw)
- contents.font.color = system_color
- contents.draw_text(dx+4, dy, dw-8, 24, vocab(:element))
- icons = []
- (@skill.element_set).each do |state_id|
- next if $data_system.elements[state_id].nil?
- icons << $data_system.elements[state_id] rescue nil
- break if icons.size >= 8
- end
- draw_icons(dx, dy, dw, icons)
- end
- def draw_removes(dx, dy, dw)
- draw_background_box(dx, dy, dw)
- contents.font.color = system_color
- contents.draw_text(dx+4, dy, dw-8, 24, vocab(:removes))
- icons = []
- (@skill.minus_state_set).each do |state_id|
- next if $data_states[state_id].nil?
- icons << $data_states[state_id].name
- break if icons.size >= 8
- end
- draw_icons(dx, dy, dw, icons)
- end
- def draw_icons(dx, dy, dw, icons)
- if !icons.size == 0
- dx += dw - 4
- dx -= icons.size * 24
- icons.each {|icon_id| draw_icon(icon_id, dx, dy); dx += 24}
- else
- contents.font.color = normal_color
- contents.font.color.alpha = translucent_alpha
- contents.draw_text(dx+4, dy, dw-8, 24, vocab(:empty), 2)
- end
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_Command_Base
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_Command_Base < Window_Selectable
- def initialize(width, commands)
- super(0, 0, width, commands.size * 32 + 32)
- @item_max, @commands = commands.size, commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- refresh
- select(0)
- end
- def refresh; end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_SkillCommand
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_SkillCommand < Window_Command_Base
- attr_reader :skill_window
- def initialize(array)
- @data = array[1]
- super(160, array[0])
- end
- def refresh
- self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
- @item_max.times {|i| draw_item(i)} if @item_max > 0
- end
- def method; return @data[self.index]; end
- def alignment
- return Menu.main_menu_align if $ace_script[:ace_main_menu]
- return 1
- end
- def method; return @data[self.index]; end
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4; rect.width -= 8
- contents.clear_rect(rect)
- contents.font.color = normal_color
- if CUSTOM_SKILL_COMMANDS.include?(@data[index])
- switch = CUSTOM_SKILL_COMMANDS[@data[index]][1]
- enabled = switch <= 0 ? true : $game_switches[switch]
- end
- contents.font.color.alpha = enabled ? 255 : translucent_alpha
- contents.draw_text(rect, @commands[index], alignment)
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Scene_Skill
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Scene_Skill < Scene_Base
- include ACE::SKILL_SYSTEM
- attr_accessor :actor
- def initialize(actor_index = 0)
- @actor_index = actor_index
- end
- def start
- super
- @actor = $game_party.actors[@actor_index]
- $page_mode_index = 0
- create_menu_layout
- create_help_window
- create_command_window
- create_item_window
- create_status_window
- end
- def create_menu_layout
- super
- return if SKILL_CONFIG[:layout].empty?
- if $ace_script[:ace_main_menu]
- @menulay.bitmap = RPG::Cache.menu("Background/#{SKILL_CONFIG[:layout]}")
- else @menulay.bitmap = RPG::Cache.picture(SKILL_CONFIG[:layout])
- end
- end
- def create_help_window
- @help_window = Window_Help.new
- end
- def create_command_window
- create_command_list
- @category_window = Window_SkillCommand.new(@menu_commands)
- @category_window.height = fitting_height(visible_line_number)
- @category_window.y = @help_window.height
- if !$game_temp.skill_index.nil?
- @category_window.select($game_temp.skill_index)
- @category_window.oy = $game_temp.skill_oy
- end
- $game_temp.skill_index = nil
- $game_temp.skill_oy = nil
- @category_window.activate
- update_help
- end
- def create_command_list
- vocab = []; data = []
- SKILL_COMMANDS.each do |command|
- case command[0]
- when :view_skills
- else
- next unless CUSTOM_SKILL_COMMANDS.include?(command[0])
- show = CUSTOM_SKILL_COMMANDS[command[0]][0]
- continue = show <= 0 ? true : $game_switches[show]
- next unless continue
- end
- data << command[0]; vocab << command[1]
- end
- @menu_commands = [vocab, data]
- end
- def fitting_height line_number
- (line_number * line_height) + (standard_padding * 2)
- end
- def line_height; return 32; end
- def standard_padding; return 16; end
- def visible_line_number; return [[@category_window.height, 3].min, 1].max; end
- def create_item_window
- dy = @category_window.y + @category_window.height
- dh = 480 - dy
- @skill_window = Window_Skill.new(0, dy, 640, dh, @actor)
- @skill_window.deactivate.unselect
- @skill_window.help_window = @help_window
- @target_window = Window_Target.new
- hide_target_window
- end
- def create_status_window
- dx = @category_window.width
- dy = @help_window.height
- @status_window = Window_SkillStatus.new(dx, dy, 480, @skill_window)
- @status_window.actor = @actor
- end
- def perform_transition
- super; SKILL_CONFIG[:fx] == 2 ? map_back : skill_back
- end
- def skill_back
- @back = Plane.new
- unless SKILL_CONFIG[:background].empty?
- if $ace_script[:ace_main_menu]
- @back.bitmap = RPG::Cache.menu("Background/#{SKILL_CONFIG[:background]}")
- else @back.bitmap = RPG::Cache.picture(SKILL_CONFIG[:background])
- end
- end
- @back.z = 10
- Graphics.transition(SKILL_CONFIG[:tran_time],
- "Graphics/Transitions/#{SKILL_CONFIG[:tran_type]}")
- end
- def map_back
- @spriteset = Spriteset_Map.new
- Graphics.transition(transition_speed)
- end
- def terminate
- super; SKILL_CONFIG[:fx] == 2 ? @spriteset.dispose : @back.dispose
- end
- def update
- update_moving_windows?
- if @category_window.active; update_status_window; update_command_selection
- elsif @skill_window.active; update_status_window; update_skill_selection
- elsif @target_window.active; update_target_selection
- end
- end
- def update_moving_windows?
- @back.ox /= 1 if SKILL_CONFIG[:fx] == 0
- @back.oy += 1 if SKILL_CONFIG[:fx] == 0
- end
- def update_status_window
- return unless Input.trigger?(QUOTE[:button])
- $game_system.se_play($data_system.decision_se)
- page = $page_mode_index
- page == 0 ? page = 1 : page = 0
- $page_mode_index = page
- @status_window.set_mode($page_mode_index)
- end
- def update_command_selection
- if @last_status_index != @category_window.index
- @last_status_index = @category_window.index
- update_help
- end
- cancel_command if Input.trigger?(Input::B)
- select_command if Input.trigger?(Input::C)
- actor_recovery if Input.trigger?(Input::F5) && $DEBUG
- actors_command if Input.press?(Input::R) || Input.press?(Input::L)
- end
- def cancel_command
- $game_temp.skill_index = nil
- $game_temp.skill_oy = nil
- $game_system.se_play($data_system.cancel_se)
- if $ace_script[:ace_main_menu]
- return unless $game_temp.menu_command_index.has_key?(:skill)
- $scene = Scene_Menu.new($game_temp.menu_command_index[:skill])
- else return_scene(Scene_Menu.new(SKILL_CONFIG[:menu_index]))
- end
- end
- def select_command
- case @category_window.method
- when :view_skills
- $game_system.se_play($data_system.decision_se)
- @category_window.deactivate; @skill_window.activate.select(0)
- else command_custom
- end
- end
- def command_custom
- return unless CUSTOM_SKILL_COMMANDS.include?(@category_window.method)
- method = CUSTOM_SKILL_COMMANDS[@category_window.method]
- if method[1] <= 0
- return if method[2].nil?
- $game_system.se_play($data_system.decision_se)
- $scene = eval("#{method[2]}.new(@actor_index)")
- else $game_system.se_play($data_system.buzzer_se)
- end
- end
- def actors_command
- $game_system.se_play($data_system.cursor_se)
- @actor_index += Input.trigger?(Input::L) ? -1 : 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Skill.new(@actor_index)
- end
- def update_skill_selection
- exit_skill if Input.trigger?(Input::B)
- open_skill if Input.trigger?(Input::C)
- actor_recovery if $DEBUG && Input.trigger?(Input::F5)
- actors_command if Input.press?(Input::R) || Input.press?(Input::L)
- end
- def exit_skill
- $game_system.se_play($data_system.cancel_se)
- @category_window.activate
- @skill_window.deactivate.unselect
- end
- def open_skill
- @skill = @skill_window.skill
- @actor.last_skill_id = @skill.id if !@skill.nil?
- if @actor.skill_can_use?(@skill.id)
- $game_system.se_play($data_system.decision_se)
- determine_skill
- else $game_system.se_play($data_system.buzzer_se)
- end
- end
- def actor_recovery
- Audio.se_play('Audio/SE/' + '105-Heal01', 100, 100)
- @actor.sp += @actor.maxsp
- @status_window.refresh
- @skill_window.refresh if @skill_window.visible
- end
- def determine_skill
- if @skill.for_friend?
- show_target_window
- if @skill.for_all?
- @target_window.select(99)
- elsif @skill.for_user?
- @target_window.select(@actor_index + 100)
- else
- if $game_party.last_target_index < @target_window.item_max
- @target_window.select($game_party.last_target_index)
- else @target_window.select(0)
- end
- end
- else use_skill_nontarget
- end
- end
- def update_target_selection
- target_cancel if Input.trigger?(Input::B)
- target_select if Input.trigger?(Input::C)
- end
- def target_cancel
- $game_system.se_play($data_system.cancel_se)
- @skill_window.activate
- hide_target_window
- end
- def target_select
- if !@actor.skill_can_use?(@skill.id)
- $game_system.se_play($data_system.buzzer_se)
- else determine_target
- end
- end
- def determine_target
- used = false
- if @skill.for_all?
- $game_party.actors.each {|i| used |= i.skill_effect(@actor, @skill)}
- elsif @skill.for_user?
- target = $game_party.actors[@target_window.index - 100]
- used = target.skill_effect(@actor, @skill)
- else
- $game_party.last_target_index = @target_window.index
- target = $game_party.actors[@target_window.index]
- used = target.skill_effect(@actor, @skill)
- end
- used ? use_skill_nontarget : $game_system.se_play($data_system.buzzer_se)
- end
- def show_target_window
- @skill_window.deactivate
- @target_window.x = (@skill_window.index + 1) % 2 * 304
- @target_window.show.activate
- end
- def hide_target_window
- @target_window.hide.deactivate
- end
- def use_skill_nontarget
- $game_system.se_play(@skill.menu_se)
- if $ace_script[:ace_warrior_module]
- @actor.pay_skill_cost(@skill)
- else @actor.sp -= @skill.sp_cost
- end
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- if $game_party.all_dead?
- return_scene(Scene_Gameover.new)
- elsif @skill.common_event_id > 0
- $game_temp.common_event_id = @skill.common_event_id
- return_scene(Scene_Map.new)
- end
- end
- def update_help
- help_text = SKILL_DESCRIPTIONS[@category_window.method]
- @help_window.set_text(help_text) unless help_text.nil?
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Scene_Battle
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Scene_Battle
- def start_skill_select
- @skill_window = Window_Skill.new(0, 64, 640, 256, @active_battler)
- @skill_window.help_window = @help_window
- @skill_window.back_opacity = 160
- @actor_command_window.deactivate.hide
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment