Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Warrior Engine - XP Core Engine v1.32
- # ■ Author : Bigace360
- #==============================================================================
- # ■ Version History:
- # v 1.00 - < 05.30.2012 >
- # ▼ First relase
- #
- # v 1.12 - < 09.13.2012 >
- # ▼ Upgrade: Improve Coding
- # ▼ Split the TP Guage from the Engine
- # ▼ Added Encounter Fix
- #
- # v 1.13 - < 09.27.2012 >
- # ▼ Improved Coding
- #
- # v 1.15 - < 10.02.2012 >
- # ▼ Improved Coding
- # ▼ Overworked Gold and Steps windows to add Numeric.group
- #
- # v 1.32 - < 02.08.2013 >
- # ▼ Added MP Death
- # ▼ Added One HP Revival after battle
- # ▼ Actors name can turn red if below a certain percentage now
- # ▼ Upgrade: Added 5 more colors to the Color class
- #==============================================================================
- # ■ Introduction
- # This is the basic script for the system from Warrior Engine and is
- # required to use the scripts from the engine. This script offer some new
- # functions to be used within many scripts of the engine. The Engine was create
- # to add features that are present in RPG Maker VX/VXAce and including bug
- # fixes and GUI upgrades.
- =begin
- # -----------------------------------------------------------------------------
- # Bug Fix: Interpreter Fix
- # -----------------------------------------------------------------------------
- # The script here fixes the multi-line issue with the call script command and
- # improves the execution of the wait idea. For those who don't know. If the call
- # script evaluates to false then the event waits a frame before running the
- # script call again. (Consider it like Repeat next frame)
- #
- # If the script call was on multiple lines there was a single frame wait before
- # it continued with the next event commands. This script fixes this issue so it
- # wait whether single-line or multi-line.
- #
- # -----------------------------------------------------------------------------
- # Bug Fix: Encounter Fix
- # -----------------------------------------------------------------------------
- # This script is more or less a fix to the default rmxp encounter rate. How many
- # people have noticed that when they set the encounter step of the map to
- # something like 30, they’ll encounter monsters after 4 or 5 steps or something
- # bizarre like that? Well, this script fixes that. The default rmxp encounter
- # rate makes it so that the encounter step that you put for the map will be the
- # most amounts of steps it’ll take to encounter another monster. The default
- # script gets a random number from 1 to the number you chose plus 1. This script
- # gets a more reasonable number from the encounter step that you chose. So let
- # say that you put in 30, you’ll probably get something around 25 – 35.
- #
- # -----------------------------------------------------------------------------
- # New Feature: HALF_MP_ID and NO_MP_ID
- # -----------------------------------------------------------------------------
- # You can now have half or no mp states, just go to the database and add that
- # state, then come back to the module and change the ID to the state.
- #
- # -----------------------------------------------------------------------------
- # New Feature: Draw Actor Face
- # -----------------------------------------------------------------------------
- # You can now add actors faces by adding them to the picture folder by there
- # actor name. You can call the script into any window with this call:
- draw_actor_face(actor, x, y [,size = 96])
- # Note: You can ommite whats in the bracket if you don't want to change the
- # size. Just make sure the brackets aren't actually in the real code.
- #
- # -----------------------------------------------------------------------------
- # New Feature: Gradient Draw Text
- # -----------------------------------------------------------------------------
- == Example ==
- If You want to see your text with gradient colors, use this code:
- class Window_Base
- #--------------------------------------------------------------------------
- # * Draw Name
- # actor : actor
- # x : draw spot x-coordinate
- # y : draw spot y-coordinate
- #--------------------------------------------------------------------------
- def draw_actor_name(actor, x, y)
- gradient_text(x, y, 64, 32, actor.name, Color.new(255,0,0),
- Color.new(0,255,0), 0, false)
- end
- end
- # -----------------------------------------------------------------------------
- # New Feature: Numeric Digit Grouping
- # -----------------------------------------------------------------------------
- # This will change various scenes to display numbers in groups where they are
- # separated by a comma every three digits. Thus, a number like 1234567 will
- # show up as 1,234,567. This allows for players to read numbers quicker.
- #
- # -----------------------------------------------------------------------------
- # New Feature: GUI Modifications
- # -----------------------------------------------------------------------------
- # - There are quite a lot of different modifications you can do to the GUI. This
- # includes adding bars to HP and SP, adding Shadow and Outline to Font, changing
- # the colours of each individual font aspect, and more. Also, you can change the
- # default font setting for your games here.
- #
- # -----------------------------------------------------------------------------
- # New Methods: class Color
- # -----------------------------------------------------------------------------
- # * This Set Defines the Basic Colors
- #--------------------------------------------------------------
- Color.red
- Color.pink
- Color.orange
- Color.cyan
- Color.magenta
- Color.green
- Color.blue
- Color.yellow
- Color.purple
- Color.orange
- Color.white
- Color.black
- Color.gray
- Color.light_gray
- Color.dark_gray
- Color.clear
- Color.normal
- Color.disabled
- Color.system
- Color.crisis
- Color.knockout
- #--------------------------------------------------------------
- # * Name : Color Between
- # Info : Gets Color Between Two colors given the percent
- #--------------------------------------------------------------
- Color.color_between(color_a, color_b, percent = 0.5)
- #--------------------------------------------------------------
- # Name : Get Color
- # Info : Gets a Color
- # Call Info : Integer Value the color code to get
- # Comment : 0: Clear 1: Red 2: Blue 3:Yellow 4: Purple 5:Orange 6:Green
- # 7:White 8: Black - 10 for lighter + 10 for darker
- #--------------------------------------------------------------
- Color.get_color(value)
- # -----------------------------------------------------------------------------
- # New Methods: class Array
- # -----------------------------------------------------------------------------
- * Random array value
- <Array>.random
- <Array>.random!
- Returns a random object from the array, the method .random! is destructive,
- removing the value returned from the array.
- * Sum of the numeric values of a array
- <Array>.sum
- Returns the sum of all numeric values
- * Product of the numeric values of a array
- <Array>.product
- Returns the product of all values in the array
- * Avarage of all numeric values from the array
- <Array>.average(float = false)
- float : float flag
- Returns the average of all numeric values, if floa is true, the value
- returned is a float, otherwise it's a integer.
- * Returns the Geometric Mean of all values in the array
- <Array>.geometric_average(float = false)
- Zero To One Arguments Defaults to False
- Boolean to_float if true always returns a Float else always returns an
- Integer regardless of the Types in the array
- =end
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # SECTIONS #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # ■ Game_Objects
- # ** Warrior_Engine Module
- # ** RPG Module
- # ** Graphic Module
- # ** Array
- # ** Bitmap
- # ** Color
- # ** Font
- # ** Numeric
- # ** Game_Battler
- # ** Game_Actor
- # ** Game_Enemy
- # ** Game_Party
- # ** Game_Player
- #
- # ■ Windows
- # ** Window_Base
- # ** Window_Selectable
- # ** Window_Gold
- # ** Window_Steps
- # ** Window_Item
- # ** Window_Skill
- # ** Window_ShopBuy
- # ** Window_ShopSell
- # ** Window_BattleStatus
- #
- # ■ Scenes
- # ** Interpreter
- # ** Scene_Battle
- # ** Scene_Skill
- #
- #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
- # Script Conflicts and Compatability #
- #=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
- # This script is made strictly for RPG Maker XP. There would be no need to add
- # this to RPG Maker VX/VXace as majority of the features already exist.
- #
- # ● Alias methods
- # class Bitmap
- # def draw_text(*args)
- #
- # class Font
- # def initialize(*args)
- #
- # class Window_Base
- # def draw_actor_state
- #
- # ● Overwrite methods
- # class Game_Battler
- # def skill_can_use?
- # def dead?
- #
- # class Game_Player
- # def make_encounter_count
- #
- # class Window_Base
- # def normal_color
- # def disabled_color
- # def system_color
- # def crisis_color
- # def knockout_color
- # def draw_actor_name(actor, x, y, width = 120)
- # def draw_actor_hp(actor, x, y, width = 130)
- # def draw_actor_sp(actor, x, y, width = 130)
- # def draw_actor_exp(draw_actor_exp(actor, x, y, width = 144)
- # def draw_item_name(item, x, y, enabled = true, width = 212)
- #
- # class Window_Item
- # def draw_item
- #
- # class Window_Skill
- # def draw_item
- #
- # class Window_ShopBuy
- # def draw_item
- #
- # class Window_ShopSell
- # def draw_item
- #
- # class Window_BattleStatus
- # def refresh
- #
- # class Window_Gold
- # def refresh
- #
- # class Window_Steps
- # def refresh
- #
- # class Interpreter
- # def command_355
- #
- # class Scene_Skill
- # def update_target
- #
- #
- # Due to the rewrite in most of these classes, this Engine should be above all
- # other of my custom scripts and below Scene_Debug.
- #
- # For info on script order go here:
- # http://bigaceworld.wordpress.com/tutorials/script-order/
- #==============================================================================
- # ▼ Instructions
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below Debug but above Main. Remember to save.
- #
- # Edit the settings in the module below as you see fit.
- #
- #==============================================================================
- # ■ Special Thanks:
- # Bigace360 ~ For creating the engine
- #==============================================================================
- #
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Warrior Engine (Setting module for the Warrior Engine)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- module Warrior_Engine
- #=============================================================================
- # ▼ 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 Core below this one.
- #=============================================================================
- module MESSAGE
- #--------------------------------------------------------------------------
- # * New method: required_script
- #--------------------------------------------------------------------------
- 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
- #--------------------------------------------------------------------------
- # * New method: exit_message
- #--------------------------------------------------------------------------
- def self.exit_message(message, name, req, version)
- name = self.script_name(name)
- req = self.script_name(req)
- print(sprintf(message, name, req, version))
- exit
- end
- #--------------------------------------------------------------------------
- # * New method: script_name
- #--------------------------------------------------------------------------
- def self.script_name(name, ext = "WE")
- name = name.to_s.gsub("_", " ").upcase.split
- name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
- name.join(" ")
- end
- end
- #=============================================================================
- # ▼ BEGIN CONFIGURATIONS HERE BELOW
- #=============================================================================
- module CORE
- #--------------------------------------------------------------------------
- # - Interpreter command_355 fix -
- #--------------------------------------------------------------------------
- # The script now waits on :wait. (And FalseClass for compatibility reasons)
- # It is easy to change what call script should wait on. :wait conveys it's
- # purpose much better than simply false and scripts accidentally evaluating
- # to :wait is much less likely to happen than for false.
- #--------------------------------------------------------------------------
- SCRIPT_WAIT_RESULTS = [:wait, FalseClass]
- #--------------------------------------------------------------------------
- # - Change Default Font -
- #--------------------------------------------------------------------------
- # This allows you to change the default font if that's what you wish to do
- # with your game. This array orders the fonts by priority. If the player
- # lacks the font in the front of the array, the game will skip that font
- # and choose the next available font in line.
- #--------------------------------------------------------------------------
- DEFAULT ={
- # Default Fonts: ["Arial"]
- :name => ["UmePlus Gothic", "Arial", "Verdana", "Courier New"],
- # Adjusts font size. Default: 22
- :size => 18,
- # Makes font bold. Default: false
- :bold => false,
- # Makes font italic. Default: false
- :italic => false,
- # Default: 255, 255, 255, 255
- :colour => Color.new(255, 255, 255, 255),
- # Gives font a shadow. Default: false
- :shadow => true,
- # Gives font an outline. Default: true
- :outline => true,
- # Default: 0, 0, 0, 128
- :outline_color => Color.new(0, 0, 0, 128),
- }
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - State Images -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # If true it turns the states from words to images. Just place an icon in
- # the icon folder with the same name as the state in the database.
- # The larger the width, the more icons appear, make sure it's a multiple of
- # 24 or you'll probably only have half of an icon appear.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- STATE ={
- :image => true,
- :width => 240,
- }
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - SHOW FACE -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # if true it allows for the face image to appear. Just in case you don't
- # have a face image to begin with.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- SHOW_FACE = true
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - Digit Grouping -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Setting this to true will cause numbers to be grouped together when they
- # are larger than a thousand. For example, 12345 will appear as 12,345.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- GROUP_DIGITS = true
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - Danger? - (HP % that show low HP Animation)
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- Danger_Value = 25
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - death_state? - (Get State ID of K.O.)
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- DEATH_STATE_ID = 1
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - half_mp - (Get State ID of half_mp)
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- HALF_MP_ID = 17
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - no_mp - (Get State ID of no_mp)
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- NO_MP_ID = 18
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - MP Death - (Kill actor if mp reachs 0)
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- MP_DEATH = false
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - 1 HP Revival - (Dead actors are returned to 1 HP after battle)
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- HP1_REVIVE = false
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - NAME_ALERT - (When Hp goes below the crisis limit, name text changes color)
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- NAME_ALERT = true
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - System Text Options -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Here, you can adjust the transparency used for disabled items, the %
- # needed for HP and MP to enter "crisis" mode.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- TRANSPARENCY = 160 # Adjusts transparency of disabled items. Default: 160
- HP_CRISIS = 0.25 # When HP is considered critical. Default: 0.25
- MP_CRISIS = 0.25 # When MP is considered critical. Default: 0.25
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - HP/MP Gauge Settings -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # You can modify the way your gauges appear in the game. If you wish for
- # them to have an outline, it's possible. Adjust how the Gauges appears for
- # the Warrior Engine here. This includes the text display, the colour of the
- # gauges, and more. Adjust it all here.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #If false, it returns them to their original methods
- DRAW_GUAGES = true
- GAUGE_OUTLINE = true
- # Colours for HP/MP gauges.
- #------------------------------------
- HP_COLOR1 = Color.new(224, 128, 64)
- HP_COLOR2 = Color.new(240, 192, 64)
- #------------------------------------
- SP_Color1 = Color.new(64, 128, 192)
- SP_COLOR2 = Color.new(64, 192, 240)
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - EXP Gauge Settings -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Adjust how the EXP Gauge appears for the Warrior Engine here. This
- # includes the text display, the font size, the colour of the gauges, and
- # more. Adjust it all here. Note: make sure Draw_Gauge is true before
- # touching this section.
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Text used for EXP
- EXP_TEXT = "EXP"
- # The way EXP percentage will be displayed.
- EXP_PERCENT = "%1.2f%%"
- # Text to replace percentage when max level.
- MAX_LVL_TEXT = "MAX LEVEL"
- # Colours for exp gauge.
- EXP_GAUGE1 = Color.new(0, 160, 16)
- EXP_GAUGE2 = Color.new(102, 204, 64)
- #===========================================================================
- # ▼ 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.
- #===========================================================================
- 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
- #--------------------------------------------------------------------------
- # full_convert_hash
- #--------------------------------------------------------------------------
- def full_convert_hash(hash)
- result = {}
- hash.each {|key| result[key[0]] = convert_integer_array(key[1])}
- return result
- end
- end # CORE
- end # Warrior_Engine
- #=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ▼ Import to Global Hash ▼ #
- ($ace_script ||= {})[:ace_warrior_module] = 1.32
- #=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Hidden Default Font Classes
- #=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- Font.default_name = Warrior_Engine::CORE::DEFAULT[:name]
- Font.default_size = Warrior_Engine::CORE::DEFAULT[:size]
- Font.default_bold = Warrior_Engine::CORE::DEFAULT[:bold]
- Font.default_italic = Warrior_Engine::CORE::DEFAULT[:italic]
- Font.default_color = Warrior_Engine::CORE::DEFAULT[:colour]
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Object (This class is the superclass of all other classes.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Object
- include Warrior_Engine::MESSAGE
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Graphics Module
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- module Graphics
- @@fadeout_ace = Viewport.new(0,0,640,480)
- @@fadeout_ace.z = 0x3FFFFFFF
- @@fadeout_ace.color = Color.new(0,0,0,0)
- def self.brightness; return (255 - @@fadeout_ace.color.alpha); end
- def self.brightness=(value)
- value = [[value, 0].max, 255].min
- @@fadeout_ace.color.alpha = 255 - value
- end
- def self.fadein(frames)
- return if frames <= 0
- curvalue = self.brightness
- count = (255 - self.brightness)
- frames.times do |i|
- self.brightness = curvalue + (count * i / frames)
- self.update
- end
- end
- def self.fadeout(frames)
- return if frames <= 0
- curvalue = self.brightness
- count = self.brightness
- frames.times do |i|
- self.brightness = curvalue - (count * i / frames)
- self.update
- end
- end
- def self.wait(frames)
- return if frames <= 0
- frames.times {|i| self.update}
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Array
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Array
- #-------------------------------------------------------------------------
- # * Random (Returns a Random element in the array)
- #-------------------------------------------------------------------------
- def random; return self[rand(size)]; end
- #-------------------------------------------------------------------------
- # * Random! (Returns and Deletes a Random element in the array)
- #-------------------------------------------------------------------------
- def random!; return delete_at(rand(size));end
- #---------------------------------------------------------------------------
- # * Sum (Sums all values in the array)
- #---------------------------------------------------------------------------
- def sum
- n = 0 # Initialize local variable n
- each {|num| n += num} # Sum Up Values in Array
- return n # Return number
- end
- #---------------------------------------------------------------------------
- # * Product (Returns the product of all values in the array)
- #---------------------------------------------------------------------------
- def product
- n = 1 # Setup N initialize to 1
- each {|num| n *= num} # Run Through and Find Product
- return n # Return Product
- end
- #---------------------------------------------------------------------------
- # * Average (Averages all values in the array)
- # Call Info : Zero To One Arguments Defaults to False
- # Boolean float if true always returns a Float else returns a
- # Float or a Integer depending on the Types in the array
- #---------------------------------------------------------------------------
- def average(float = false)
- self.sum / [(float ? size.to_f : size.to_i), 1].max
- end
- #---------------------------------------------------------------------------
- # * Geometric Average (Returns the Geometric Mean of all values in the array)
- # Call Info : Zero To One Arguments Defaults to False
- # Boolean to_float if true always returns a Float else
- # always returns an Integer regardless of the Types in the
- # array
- #---------------------------------------------------------------------------
- def geometric_average(float = false)
- # Return 0 if empty
- return 0 if empty?
- # Get Geometric Average
- average = product ** (1.0 / size)
- # If Float return average else convert to integer
- return (float ? average : average.to_i)
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Bitmap
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Bitmap
- def clear_rect(*args)
- color = Color.clear
- args << color
- fill_rect(*args)
- end
- #--------------------------------------------------------------------------
- # Name: gradient_fill_rect(*args)
- # Author: Kellesedee
- #--------------------------------------------------------------------------
- def gradient_fill_rect(*args)
- if args[0].is_a?(Rect)
- x, y, width, height = args[0].x,
- args[0].y,
- args[0].width,
- args[0].height
- color1 = args[1].dup
- color2 = args[2]
- vertical = args[3]
- else
- x, y, width, height = args[0..3]
- color1 = args[4].dup
- color2 = args[5]
- vertical = args[6]
- end
- dr, dg, db, da = color2.red - color1.red,
- color2.green - color1.green,
- color2.blue - color1.blue,
- color2.alpha - color1.alpha
- start_rgba = [color1.red, color1.green, color1.blue, color1.alpha]
- if vertical
- dr, dg, db, da = dr / height, dg / height, db / height, da / height
- (y...(y + height)).each do |i|
- fill_rect(x, i, width, 1, color1)
- start_rgba[0] = [start_rgba[0] + dr, 0].max
- start_rgba[1] = [start_rgba[1] + dg, 0].max
- start_rgba[2] = [start_rgba[2] + db, 0].max
- start_rgba[3] = [start_rgba[3] + da, 0].max
- color1.set(*start_rgba)
- end
- else
- dr, dg, db, da = dr / width, dg / width, db / width, da / width
- (x...(x + width)).each do |i|
- fill_rect(i, y, 1, height, color1)
- start_rgba[0] = [start_rgba[0] + dr, 0].max
- start_rgba[1] = [start_rgba[1] + dg, 0].max
- start_rgba[2] = [start_rgba[2] + db, 0].max
- start_rgba[3] = [start_rgba[3] + da, 0].max
- color1.set(*start_rgba)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Name: gradient_draw_rect(*args)
- # Author: Ramiro
- #--------------------------------------------------------------------------
- def gradient_draw_text(*args)
- if args[0].is_a?(Rect)
- x = args[0].x
- y = args[0].y
- w = args[0].width
- h = args[0].height
- text = args[1]
- color1 = args[2]
- color2 = args[3]
- aling = args[4] if args[4]
- vertical = args[5] if args[5]
- else
- x = args[0]
- y = args[1]
- w = args[2]
- h = args[3]
- text = args[4]
- color1 = args[5]
- color2 = args[6]
- aling = args[7] if args[7]
- vertical = args[8] if args[8]
- end
- aling = 0 if !aling
- vertical = false if !vertical
- text_bmp = Bitmap.new(w,h)
- text_bmp.font.name = font.name
- text_bmp.font.size = font.size
- text_bmp.font.shadow = false if text_bmp.font.respond_to?("shadow")
- text_bmp.font.outline = false if text_bmp.font.respond_to?("outline")
- text_bmp.font.border = false if text_bmp.font.respond_to?("border")
- text_bmp.font.bold = font.bold
- text_bmp.font.italic = font.italic
- text_bmp.draw_text(0,0,w,h,text,aling)
- gradient_bmp = Bitmap.new(w,h)
- gradient_bmp.gradient_fill_rect(0, 0, w, h, color1, color2, vertical)
- for x2 in 0...w
- for y2 in 0...h
- alpha_txt = text_bmp.get_pixel(x2,y2).alpha
- if alpha_txt > 0
- c = gradient_bmp.get_pixel(x2,y2)
- c.alpha = alpha_txt
- text_bmp.set_pixel(x2,y2,c)
- end
- end
- end
- draw_text(x,y,w,h,text,aling)
- blt(x,y,text_bmp,Rect.new(0,0,w,h))
- end
- alias :warrior_draw_text :draw_text unless $@
- def draw_text(*args)
- if self.font.shadow
- orig_color = self.font.color.dup
- self.font.color = Color.new(0, 0, 0, 100)
- if args[0].is_a?(Rect)
- x = args[0].x + 2
- y = args[0].y + 2
- w = args[0].width
- h = args[0].height
- text = args[1]
- align = args[2]
- else
- x = args[0] + 2
- y = args[1] + 2
- w = args[2]
- h = args[3]
- text = args[4]
- align = args[5]
- end
- align = 0 if align.nil?
- self.warrior_draw_text(x, y, w, h, text, align)
- self.font.color = orig_color
- end
- if self.font.outline
- orig_color = self.font.color.dup
- self.font.color = self.font.outline_color
- if args[0].is_a?(Rect)
- x = args[0].x
- y = args[0].y
- w = args[0].width
- h = args[0].height
- text = args[1]
- align = args[2]
- else
- x = args[0]
- y = args[1]
- w = args[2]
- h = args[3]
- text = args[4]
- align = args[5]
- end
- align = 0 if align.nil?
- self.warrior_draw_text(x + 1, y, w, h, text, align)
- self.warrior_draw_text(x - 1, y, w, h, text, align)
- self.warrior_draw_text(x, y + 1, w, h, text, align)
- self.warrior_draw_text(x, y - 1, w, h, text, align)
- self.warrior_draw_text(x + 1, y + 1, w, h, text, align)
- self.warrior_draw_text(x + 1, y - 1, w, h, text, align)
- self.warrior_draw_text(x - 1, y - 1, w, h, text, align)
- self.warrior_draw_text(x - 1, y + 1, w, h, text, align)
- self.font.color = orig_color
- end
- self.warrior_draw_text(*args)
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Color
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Color
- #-------------------------------------------------------------------------
- # * This Set Defines the Basic Colors so now you can do Color.(color)
- #-------------------------------------------------------------------------
- def self.red; return Color.new(255, 0, 0); end
- def self.pink; return Color.new(255, 175, 175); end
- def self.green; return Color.new(0, 128, 0); end
- def self.blue; return Color.new(0, 0, 255); end
- def self.yellow; return Color.new(255, 255, 0); end
- def self.purple; return Color.new(128, 0, 128); end
- def self.orange; return Color.new(255, 128, 0); end
- def self.white; return Color.new(255, 255, 255); end
- def self.black; return Color.new(0, 0, 0); end
- def self.gray; return Color.new(128, 128, 128); end
- def self.light_gray; return Color.new(192,192,192); end
- def self.dark_gray; return Color.new(64,64,64); end
- def self.cyan; return Color.new(0,255,255); end
- def self.magenta; return Color.new(255,255,0); end
- def self.clear; return Color.new(0, 0, 0, 0); end
- def Color.normal; return Color.new(255, 255, 255, 255); end
- def Color.disabled; return Color.new(255, 255, 255, 128); end
- def Color.system; return Color.new(192, 224, 255, 255); end
- def Color.crisis; return Color.new(255, 255, 64, 255); end
- def Color.knockout; return Color.new(255, 64, 0); end
- #-------------------------------------------------------------------------
- # * Name : Color Between
- # Info : Gets Color Between Two colors given the percent
- # Author : SephirothSpawn
- # Call Info : Start Color, Finish Color, Percent
- #-------------------------------------------------------------------------
- @color_between = {}
- def self.color_between(color_a, color_b, percent = 0.5)
- # Gets Save Key
- key = [color_a, color_b, percent]
- return @color_between[key] if @color_between.has_key?(key)
- # Calculates New Color
- r = Integer(color_a.red + (color_b.red - color_a.red) * percent)
- g = Integer(color_a.green + (color_b.green - color_a.green) * percent)
- b = Integer(color_a.blue + (color_b.blue - color_a.blue) * percent)
- a = Integer(color_a.alpha + (color_b.alpha - color_a.alpha) * percent)
- # Saves Color
- @color_between[key] = Color.new(r, g, b, a)
- # Returns Color
- return @color_between[key]
- end
- #-------------------------------------------------------------------------
- # Name : Get Color
- # Info : Gets a Color
- # Author : Trickster
- # Call Info : Integer Value the color code to get
- # Comment : 0: Clear 1: Red 2: Blue 3:Yellow 4: Purple 5:Orange 6:Green
- # 7:White 8: Black - 10 for lighter + 10 for darker
- #-------------------------------------------------------------------------
- def self.get_color(value)
- # Convert to 0-8
- color_value = value < 0 ? value + 10 : value % 10
- # Branch According to number
- case color_value
- when 0 then return # Clear
- when 1 then r = 255; g = 0; b = 0 # Red
- when 2 then r = 0; g = 0; b = 255 # Blue
- when 3 then r = 255; g = 255; b = 0 # Yellow
- when 4 then r = 255; g = 0; b = 255 # Purple
- when 5 then r = 255; g = 128; b = 0 # Orange
- when 6 then r = 0; g = 255; b = 0 # Green
- when 7 then r = 255; g = 255; b = 255 # White
- when 8 then r = 0; g = 0; b = 0 # Black
- end
- # Convert if Lighter/Darker
- if value < 0; r += 64; g += 64; b += 64
- elsif value > 10; r -= 64; g -= 64; b -= 64
- end
- # Correction
- r = [[0,r].max, 255].min
- g = [[0,g].max, 255].min
- b = [[0,b].max, 255].min
- return Color.new(r,g,b)
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Font
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Font
- @@default_shadow = Warrior_Engine::CORE::DEFAULT[:shadow]
- @@default_outline = Warrior_Engine::CORE::DEFAULT[:outline]
- @@default_outline_color = Warrior_Engine::CORE::DEFAULT[:outline_color]
- attr_accessor(:shadow_color, :outline_color)
- attr_reader(:shadow, :outline)
- alias warrior_engine_int initialize unless $@
- def initialize(*args)
- warrior_engine_int(*args)
- @shadow = @@default_shadow
- @outline, @outline_color = @@default_outline, @@default_outline_color
- end
- def self.default_shadow=(bool)
- @@default_shadow = bool
- @@default_outline = false unless bool == false
- end
- def self.default_shadow; return @@default_shadow; end
- def self.default_outline=(bool)
- @@default_outline = bool
- @@default_shadow = false unless bool == false
- end
- def self.default_outline; return @@default_outline; end
- def self.default_outline_color=(color)
- raise(TypeError, 'Cannot use a non Color object for color.') unless color.ialign?(Color)
- @@default_outline_color = color
- end
- def self.default_outline_color; return @@default_outline_color; end
- def shadow=(bool)
- @shadow = bool
- @outline = false unless bool == false
- end
- def outline=(bool)
- @shadow = false unless bool == false
- @outline = bool
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Numeric
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Numeric
- def group
- return self.to_s unless Warrior_Engine::CORE::GROUP_DIGITS
- self.to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/,'\1,\2')
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Game_Battler
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Game_Battler
- include Warrior_Engine::CORE
- def danger?; return @hp <= ((self.maxhp * Danger_Value)/ 100); end
- def death_state?; state?(DEATH_STATE_ID); end
- def alive?; exist? && !death_state?; end
- def silent?; return (!@hidden && restriction == 1); end
- def dead?
- exist? && death_state?
- return unless MP_DEATH
- return ((@hp == 0 || @sp == 0) && !@immortal)
- end
- # ---------------------------------------------------------------------------
- def half_sp_cost
- return state?(HALF_MP_ID)
- end
- def no_sp_cost
- return state?(NO_MP_ID)
- end
- def calc_sp_cost(skill)
- half_sp_cost ? (skill.sp_cost / 2) : no_sp_cost ? (skill.sp_cost * 0) : skill.sp_cost
- end
- def pay_skill_cost(skill)
- self.sp -= calc_sp_cost(skill)
- end
- # ---------------------------------------------------------------------------
- def skill_can_use?(skill_id)
- skill = $data_skills[skill_id]
- return if skill.nil?
- return false if calc_sp_cost(skill) >= sp
- return false if dead?
- return false if silent? && skill.spi_f == 0
- if $game_temp.in_battle
- return (skill.occasion == 0 || skill.occasion == 1)
- else return (skill.occasion == 0 || skill.occasion == 2)
- end
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Game_Actor
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Game_Actor < Game_Battler
- def actor?
- return true
- end
- def actor
- return $data_actors[@actor_id]
- end
- def max_level
- return actor.final_level
- end
- def max_level?
- @level >= max_level
- end
- def weapons
- result = [$data_weapons[@weapon_id]]
- return result
- end
- def armors
- result = []
- (1..4).each {|i| eval("result << $data_armors[@armor#{i}_id]")}
- return result
- end
- def equips; return weapons + armors; end
- def now_exp; return @exp - @exp_list[@level]; end
- def next_exp
- return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
- end
- #-----------------------------------------------------------
- def hp_rate; @hp.to_f / maxhp; end
- def sp_rate; maxsp > 0 ? @sp.to_f / maxsp : 0; end
- def exp_rate; next_exp > 0 ? now_exp.to_f / next_exp : 0; end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Game_Enemy
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Game_Enemy < Game_Battler
- def actor?
- return false
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Game_Party
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Game_Party
- def items
- result = []
- @items.keys.sort.each {|i| result << $data_items[i] if @items[i] > 0}
- @weapons.keys.sort.each {|i| result << $data_weapons[i] if @weapons[i] > 0}
- @armors.keys.sort.each {|i| result << $data_armors[i] if @armors[i] > 0}
- return result
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Game_Player
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Game_Player < Game_Character
- def make_encounter_count
- return if $game_map.map_id == 0
- n = $game_map.encounter_step
- o = $game_map.encounter_step/2
- p = $game_map.encounter_step + o
- p.times {|i| @encounter_count = i}
- if @encounter_count > n + 10
- @encounter_count -= 5
- return unless @encounter_count > n + 10
- @encounter_count -= 5
- @encounter_count -= 5 if @encounter_count > n + 10
- elsif @encounter_count < n - 10
- @encounter_count += 5
- return unless @encounter_count < n - 10
- @encounter_count += 5
- @encounter_count += 5 if @encounter_count < n - 10
- end
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_Base
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_Base < Window
- include Warrior_Engine::CORE
- alias :ace_draw_actor_state :draw_actor_state
- def draw_text(*args); contents.draw_text(*args); end
- def text_size(str); contents.text_size(str); end
- def gradient_text(*args); contents.gradient_draw_text(*args); end
- def gauge_back_color; return Color.new(32, 32, 64); end
- def hp_gauge_color1; return HP_COLOR1; end
- def hp_gauge_color2; return HP_COLOR2; end
- def sp_gauge_color1; return SP_Color1; end
- def sp_gauge_color2; return SP_COLOR2; end
- def exp_gauge1; return EXP_GAUGE1; end
- def exp_gauge2; return EXP_GAUGE2; end
- def translucent_alpha; return TRANSPARENCY; end
- def normal_color; return Color.normal; end
- def disabled_color; return Color.disabled; end
- def system_color; return Color.system; end
- def crisis_color; return Color.crisis; end
- def knockout_color; return Color.knockout; end
- def hp_color(actor)
- return knockout_color if actor.hp == 0
- return crisis_color if actor.hp < actor.maxhp * HP_CRISIS
- return normal_color
- end
- def sp_color(actor)
- return crisis_color if actor.sp < actor.maxsp * MP_CRISIS
- return normal_color
- 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 line_height; return 32; end
- def standard_padding; return 16; end
- def translucent_alpha; return 160; end
- def fitting_height(line_number)
- (line_number * line_height) + (standard_padding * 2)
- end
- def draw_actor_name(actor, x, y, width = 120)
- change_color(NAME_ALERT ? hp_color(actor) : normal_color)
- draw_text(x, y, width, line_height, actor.name)
- end
- def draw_actor_hp(actor, x, y, width = 130)
- bar_y = -24 + y + (Font.default_size * 2 /3)
- if DRAW_GUAGES
- draw_gauge(x, bar_y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
- end
- contents.font.size = 17
- change_color(system_color)
- draw_text(x, bar_y+12, 30, 32, $data_system.words.hp)
- draw_current_and_max_values(x, bar_y+12, width, actor.hp.group,
- actor.maxhp.group, hp_color(actor), normal_color)
- reset_font_settings
- end
- def draw_actor_sp(actor, x, y, width = 130)
- bar_y = -24 + y + (Font.default_size * 2 /3)
- if DRAW_GUAGES
- draw_gauge(x, bar_y, width, actor.sp_rate, sp_gauge_color1, sp_gauge_color2)
- end
- contents.font.size = 17
- change_color(system_color)
- draw_text(x, bar_y+12, 30, 32, $data_system.words.sp)
- draw_current_and_max_values(x, bar_y+12, width, actor.sp.group,
- actor.maxsp.group, sp_color(actor), normal_color)
- reset_font_settings
- end
- def draw_actor_exp(actor, x, y, width = 144)
- if DRAW_GUAGES
- return draw_warrior_actor_exp(actor, x, y, width)
- else return draw_ace_actor_exp(actor, x, y, width)
- end
- end
- def draw_ace_actor_exp(actor, x, y, width = 130)
- s1 = actor.now_exp; s2 = actor.next_exp
- change_color(system_color)
- draw_text(x, y, self.width, 32, EXP_TEXT)
- dx = text_size(EXP_TEXT).width
- change_color(normal_color)
- s1 = s1.group if s1.is_a?(Integer); s2 = s2.group if s2.is_a?(Integer)
- draw_text(x + (dx*1.5), y, width, 32, "#{s1} / #{s2}", 1)
- end
- def draw_warrior_actor_exp(actor, x, y, width = 130)
- bar_y = -24 + y + (Font.default_size * 2 /3)
- draw_gauge(x, bar_y, width, actor.exp_rate, exp_gauge1, exp_gauge2)
- contents.font.size = 17
- change_color(system_color)
- draw_text(x, bar_y+12, self.width, 32, EXP_TEXT)
- change_color(normal_color)
- xr = x + width
- if actor.next_exp == 0
- text = MAX_LVL_TEXT
- else text = sprintf(EXP_PERCENT, actor.now_exp * 100.0 / actor.next_exp)
- end
- draw_text(x, bar_y+12, width, 32, text, 2)
- reset_font_settings
- end
- def draw_exp_gauge(dx, dy, dw, rate, color1, color2)
- dw += 2 if GAUGE_OUTLINE
- fill_w = (actor.next_exp == 0 ? dw : [(dw * rate).to_i, dw].min)
- warrior_guage(dx, dy, dw, rate, fill_w, color1, color2)
- end
- def draw_gauge(dx, dy, dw, rate, color1, color2)
- dw -= 2 if GAUGE_OUTLINE
- fill_w = [(dw * rate).to_i, dw].min
- warrior_guage(dx, dy, dw, rate, fill_w, color1, color2)
- end
- def warrior_guage(dx, dy, dw, rate, fill_w, color1, color2, dh = 12)
- gauge_h = dh
- gauge_y = dy + 24
- if GAUGE_OUTLINE
- outline_colour = gauge_back_color
- outline_colour.alpha = translucent_alpha
- contents.fill_rect(dx, gauge_y-1, dw+2, gauge_h+2, outline_colour)
- dx += 1
- end
- contents.fill_rect(dx, gauge_y, dw, gauge_h, gauge_back_color)
- contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
- end
- def draw_current_and_max_values(x, y, width, current, max, color1, color2)
- change_color(color1)
- xr = x + width
- if width < 120
- draw_text(xr - 44, y, 44, 32, current, 2)
- else
- draw_text(xr - 99, y, 44, 32, current, 2)
- change_color(color2)
- draw_text(xr - 55, y, 11, 32, "/", 2)
- draw_text(xr - 44, y, 44, 32, max, 2)
- end
- end
- def draw_actor_face(actor, x, y, size = 96)
- bitmap = RPG::Cache.picture(actor.name)
- return if bitmap.nil?
- cw, ch = bitmap.width, bitmap.height
- if size > 0
- dst_cw = dst_ch = size
- else dst_cw, dst_ch = bitmap.width, bitmap.height
- end
- dst_rect = Rect.new(x, y, dst_cw, dst_ch)
- src_rect = Rect.new(0, 0, cw, ch)
- self.contents.stretch_blt(dst_rect, bitmap, src_rect)
- end
- def draw_item_name(item, x, y, enabled = true, width = 212)
- return unless item
- draw_icon(item.icon_name, x, y + 4, enabled)
- change_color(normal_color, enabled)
- draw_text(x + 25, y, width, 32, item.name)
- end
- def draw_icon(icon_index, x, y, enabled = true)
- bitmap = RPG::Cache.icon(icon_index)
- rect = Rect.new(0, 0, 24, 24)
- self.contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
- end
- def draw_actor_state(actor, x, y, width = STATE[:width])
- return ace_draw_actor_state(actor, x, y, 120) unless STATE[:image]
- count = 0
- states = actor.states.clone
- states.sort! {|a, b| $data_states[b].rating <=> $data_states[a].rating}
- states.each do |state|
- next if $data_states[state].name == 0
- draw_icon($data_states[state].name, x + 24 * count, y+4)
- count += 1
- break if (24 * count > width - 24)
- end
- reset_font_settings
- end
- def change_color(color, enabled = true)
- contents.font.color = color
- contents.font.color.alpha = translucent_alpha unless enabled
- end
- def reset_font_settings
- change_color(normal_color)
- contents.font.size = Font.default_size
- contents.font.bold = Font.default_bold
- contents.font.italic = Font.default_italic
- contents.font.outline_color = Font.default_outline_color
- end
- def draw_currency_value(name, value, x, y, width)
- cx = text_size(name).width
- change_color(normal_color)
- draw_text(x, y, width-cx-2, 32, value.group, 2)
- change_color(system_color)
- draw_text(x, y, width, 32, name, 2)
- end
- def draw_item_number(item)
- case item
- when RPG::Item then number = $game_party.item_number(item.id)
- when RPG::Weapon then number = $game_party.weapon_number(item.id)
- when RPG::Armor then number = $game_party.armor_number(item.id)
- end
- return number
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_Selectable
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_Selectable < Window_Base
- attr_reader :item_max # item count
- alias :ace_selectable_warrior_init :initialize unless $@
- def initialize(*args)
- ace_selectable_warrior_init(*args)
- @spacing = 32
- end
- 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, 0)
- rect.width = (contents.width + @spacing) / @column_max - @spacing
- rect.height = 32
- rect.y = index / @column_max * 32
- rect.x = index % @column_max * (rect.width + @spacing)
- return rect
- end
- def item_rect_for_text(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- return rect
- end
- def clear_item(index)
- contents.clear_rect(item_rect(index))
- end
- def index=(index)
- @index = index
- update_cursor_rect
- call_update_help
- end
- def help_window=(help_window)
- @help_window = help_window
- call_update_help
- end
- def horizontal?
- page_row_max == 1
- end
- def call_update_help
- update_help if self.active && @help_window
- end
- def update
- super
- process_cursor_move
- update_cursor_rect
- call_update_help
- end
- def cursor_movable?; self.active && @item_max > 0 && @index >= 0; end
- def process_cursor_move
- return unless cursor_movable?
- last_index = @index
- cursor_down (Input.trigger?(Input::DOWN)) if Input.repeat?(Input::DOWN)
- cursor_up (Input.trigger?(Input::UP)) if Input.repeat?(Input::UP)
- cursor_right(Input.trigger?(Input::RIGHT)) if Input.repeat?(Input::RIGHT)
- cursor_left (Input.trigger? (Input::LEFT)) if Input.repeat?(Input::LEFT)
- cursor_pagedown if Input.repeat?(Input::R)
- cursor_pageup if Input.repeat?(Input::L)
- $game_system.se_play($data_system.cursor_se) if @index != last_index
- end
- def cursor_down(wrap = false)
- if (@column_max == 1 && wrap) || (@index < @item_max - @column_max)
- select((@index + @column_max) % @item_max)
- end
- end
- def cursor_up(wrap = false)
- if (@column_max == 1 && wrap) || (@index >= @column_max)
- select((@index - @column_max + @item_max) % @item_max)
- end
- end
- def cursor_right(wrap = false)
- if (@column_max >= 2) && (@index < @item_max - 1 || (wrap && horizontal?))
- select((@index + 1) % @item_max)
- end
- end
- def cursor_left(wrap = false)
- if (@column_max >= 2) && (@index > 0 || (wrap && horizontal?))
- select((@index - 1 + @item_max) % @item_max)
- end
- end
- def cursor_pagedown
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- self.top_row += self.page_row_max
- select([@index + self.page_item_max, @item_max - 1].min)
- end
- end
- def cursor_pageup
- if self.top_row > 0
- self.top_row -= self.page_row_max
- select([@index - self.page_item_max, 0].max)
- end
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_Gold
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_Gold < Window_Base
- def refresh
- contents.clear
- draw_currency_value(currency_unit, value, dx, 0, content_width)
- end
- def dx; return 4; end
- def content_width; return contents.width - 8; end
- def value; $game_party.gold; end
- def currency_unit; $data_system.words.gold; end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_Steps
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_Steps < Window_Base
- def refresh
- contents.clear
- change_color(system_color)
- draw_text(4, 0, 120, 32, currency_unit)
- change_color(normal_color)
- draw_text(4, 32, 120, 32, value.group, 2)
- end
- def value; $game_party.steps; end
- def currency_unit; "Step Count"; end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_Item
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_Item < Window_Selectable
- def enable?(item)
- item.is_a?(RPG::Item) && $game_party.item_can_use?(item.id)
- end
- def draw_item(index)
- rect = item_rect(index)
- contents.clear_rect(rect)
- item = @data[index]
- return if item.nil?
- number = draw_item_number(item)
- enabled = enable?(item)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enabled)
- draw_text(rect, sprintf(":%2d", number), 2)
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_Skill
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_Skill < Window_Selectable
- def enable?(skill)
- @actor.skill_can_use?(skill.id)
- end
- def draw_item(index)
- skill = @data[index]
- return if skill.nil?
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(skill, rect.x, rect.y, enable?(skill))
- draw_skill_cost(rect, skill)
- end
- def draw_skill_cost(rect, skill)
- return unless @actor.calc_sp_cost(skill) > 0
- colour = Color.color_between(Color.blue, Color.normal)
- change_color(colour, enable?(skill))
- 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
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_ShopBuy
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_ShopBuy < Window_Selectable
- def draw_item(index)
- item = @data[index]
- number = draw_item_number(item)
- enabled = (item.price <= $game_party.gold && number < 99)
- rect = item_rect(index)
- contents.clear_rect(rect)
- draw_item_name(item, rect.x, rect.y, enabled)
- rect.width -= 4
- draw_text(rect, item.price, 2)
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_ShopSell
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- unless $ace_script[:scene_shopbase]
- class Window_ShopSell < Window_Selectable
- def enable?(item)
- return (item.price > 0)
- end
- def draw_item(index)
- rect = item_rect(index)
- contents.clear_rect(rect)
- item = @data[index]
- return if item.nil?
- number = draw_item_number(item)
- enabled = enable?(item)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enabled)
- draw_text(rect, sprintf(":%2d", number), 2)
- end
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Window_BattleStatus
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Window_BattleStatus < Window_Base
- def refresh
- contents.clear
- @item_max = $game_party.actors.size
- ($game_party.actors.size).times do |i|
- actor = $game_party.actors[i]
- actor_x = i * 160 + 4
- width = 124
- contents.font.size = 18
- draw_actor_name(actor, actor_x, 0)
- draw_level_state(actor, actor_x, i)
- gx = 11
- contents.font.size = 16
- draw_actor_hp(actor, actor_x, line_height+gx, width)
- actor.skills.size.times {|i| @skill = $data_skills[actor.skills[i]]}
- draw_sp(actor, actor_x, width)
- end
- end
- def draw_sp(actor, actor_x, width)
- draw_actor_sp(actor, actor_x, line_height*2, width)
- end
- def line_height; return 24; end
- def draw_level_state(actor, x, i)
- if @level_up_flags[i]
- change_color(normal_color)
- draw_text(x, 96, 120, 32, "LEVEL UP!")
- else
- draw_actor_state(actor, x, 96)
- end
- end
- def draw_current_and_max_values(dx, dy, dw, current, max, color1)
- change_color(color1)
- draw_text(dx, dy, dw, line_height, current.group, 2)
- end
- def draw_actor_hp(actor, dx, dy, width = 124)
- draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
- change_color(system_color)
- cy = (Font.default_size - contents.font.size) / 2 + 15
- draw_text(dx+2, dy+cy, 30, 24, $data_system.words.hp)
- draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.maxhp,
- hp_color(actor))
- end
- def draw_actor_sp(actor, dx, dy, width = 124)
- draw_gauge(dx, dy, width, actor.sp_rate, sp_gauge_color1, sp_gauge_color2)
- change_color(system_color)
- cy = (Font.default_size - contents.font.size) / 2 + 15
- draw_text(dx+2, dy+cy, 30, line_height, $data_system.words.sp)
- draw_current_and_max_values(dx, dy+cy, width, actor.sp, actor.maxsp,
- sp_color(actor))
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Interpreter
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Interpreter
- def command_355
- script = @list[@index].parameters[0] + "\n"
- current_index = @index
- loop do
- if @list[@index+1].code == 655
- script += @list[@index+1].parameters[0] + "\n"
- else break
- end
- @index += 1
- end
- result = eval(script)
- if Warrior_Engine::CORE::SCRIPT_WAIT_RESULTS.include?(result)
- @index = current_index
- return false
- end
- return true
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Scene_Skill
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class Scene_Skill
- def update_target
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @skill_window.activate
- @target_window.deactivate.hide
- elsif Input.trigger?(Input::C)
- if !@actor.skill_can_use?(@skill.id)
- $game_system.se_play($data_system.buzzer_se)
- else determine_target
- end
- end
- end
- def determine_target
- if @target_window.index == -1
- used = false
- $game_party.actors.each {|actor| used |= i.skill_effect(@actor, @skill)}
- elsif @target_window.index <= -2
- target = $game_party.actors[@target_window.index + 10]
- used = target.skill_effect(@actor, @skill)
- elsif @target_window.index >= 0
- target = $game_party.actors[@target_window.index]
- used = target.skill_effect(@actor, @skill)
- end
- if used
- use_skill_nontarget
- else $game_system.se_play($data_system.buzzer_se)
- end
- end
- def use_skill_nontarget
- $game_system.se_play(@skill.menu_se)
- @actor.pay_skill_cost(@skill)
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- elsif @skill.common_event_id > 0
- $game_temp.common_event_id = @skill.common_event_id
- $scene = Scene_Map.new
- end
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ Scene_Battle
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- class Scene_Battle
- alias :ace_warrior_battle_end :battle_end
- def battle_end(result)
- ace_warrior_battle_end(result)
- if Warrior_Engine::CORE::HP1_REVIVE &&
- $game_party.actors.any? {|actor| actor.dead?}
- $game_party.actors.each_index do |i|
- $game_party.actors[i].hp = 1 if $game_party.actors[i].dead?
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment