Advertisement
Papa2007HD

1

Oct 25th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 46.54 KB | None | 0 0
  1.    
  2.  
  3.     #==============================================================================
  4.     #
  5.     # ▼ Yanfly Engine Ace - Ace Core Engine v1.09
  6.     # -- Last Updated: 2012.02.19
  7.     # -- Level: Easy, Normal
  8.     # -- Requires: n/a
  9.     #
  10.     #==============================================================================
  11.      
  12.     $imported = {} if $imported.nil?
  13.     $imported["YEA-CoreEngine"] = true
  14.      
  15.     #==============================================================================
  16.     # ▼ Updates
  17.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  18.     # 2012.02.19 - Bug Fixed: Parallax updating works properly with looping maps.
  19.     # 2012.02.10 - Bug Fixed: Forced actions no longer cancel out other actions
  20.     #              that have been queued up for later.
  21.     # 2012.01.08 - Font resets no longer reset bold and italic to off, but instead
  22.     #              to whatever default you've set.
  23.    # 2011.12.26 - New Bugfix: When using substitute, allies will no longer take
  24.    #              place of low HP allies for friendly skills.
  25.    # 2011.12.20 - New Bugfix: Force Action no longer cancels out an actor's queue.
  26.     #              Credits to Yami for finding and making the fix for!
  27.     #              Switch added for those who want removed forced action battlers.
  28.     # 2011.12.15 - Updated for better menu gauge appearance.
  29.     # 2011.12.10 - Bug Fixed: Right and bottom sides of the map would show
  30.     #              the left and top sides of the map.
  31.     #            - Bug Fixed: Viewport sizes didn't refresh from smaller maps.
  32.    # 2011.12.07 - New Bugfix: Dual weapon normal attacks will now play both
  33.    #              animations without one animation interrupting the other.
  34.    # 2011.12.04 - Updated certain GUI extensions for increased screen size.
  35.    #            - More efficient digit grouping method credits to TDS.
  36.    # 2011.12.01 - Started Script and Finished.
  37.    #
  38.    #==============================================================================
  39.    # ▼ Introduction
  40.    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  41.    # This is the core engine for Yanfly Engine Ace, made for RPG Maker VX Ace.
  42.    # This script provides various changes made to the main engine including bug
  43.    # fixes and GUI upgrades.
  44.    #
  45.    # -----------------------------------------------------------------------------
  46.    # Bug Fix: Animation Overlay
  47.    # -----------------------------------------------------------------------------
  48.    # - It's the same bug from VX. When an all-screen animation is played against a
  49.     # group of enemies, the animation bitmap is actually made multiple times, thus
  50.     # causing a pretty extreme overlay when there are a lot of enemies on screen.
  51.     # This fix will cause the animation to play only once.
  52.     #
  53.     # -----------------------------------------------------------------------------
  54.     # Bug Fix: Animation Interruption
  55.     # -----------------------------------------------------------------------------
  56.     # - A new bug. When a character dual wields and attacks a single target, if an
  57.     # animation lasts too long, it will interrupt and/or halt the next animation
  58.     # from occurring. This script will cause the first animation to finish playing
  59.     # and then continue forth.
  60.     #
  61.     # -----------------------------------------------------------------------------
  62.     # Bug Fix: Battle Turn Order Fix
  63.     # -----------------------------------------------------------------------------
  64.     # - Same bug from VX. For those who use the default battle system, once a
  65.     # turn's started, the action order for the turn becomes set and unchanged for
  66.    # the remainder of that turn. Any changes to a battler's AGI will not be
  67.     # altered at all even if the battler were to receive an AGI buff or debuff.
  68.     # This fix will cause the speed to be updated properly upon each action.
  69.     #
  70.     # -----------------------------------------------------------------------------
  71.     # Bug Fix: Forced Action Fix
  72.     # -----------------------------------------------------------------------------
  73.     # - A new bug. When a battler is forced to perform an action, the battler's
  74.    # queued action is removed and the battler loses its place in battle. This
  75.    # fix will resume queue after a forced action.
  76.    #
  77.    # -----------------------------------------------------------------------------
  78.    # Bug Fix: Gauge Overlap Fix
  79.    # -----------------------------------------------------------------------------
  80.    # - Same bug from VX. When some values exceed certain amounts, gauges can
  81.    # overextend past the width they were originally designed to fit in. This fix
  82.    # will prevent any overextending from gauges.
  83.    #
  84.    # -----------------------------------------------------------------------------
  85.    # Bug Fix: Held L and R Menu Scrolling
  86.    # -----------------------------------------------------------------------------
  87.    # - Before in VX, you can scroll through menus by holding down L and R buttons
  88.    # (Q and W on the keyboard) to scroll through menus quickly. This fix will
  89.    # re-enable the ability to scroll through menus in such a fashion. Disable it
  90.    # in the module if you wish to.
  91.    #
  92.    # -----------------------------------------------------------------------------
  93.    # Bug Fix: Substitute Healing
  94.    # -----------------------------------------------------------------------------
  95.    # If an actor has the substitute (cover) flag on them, they will attempt to
  96.    # take the place of low HP allies when they're the target of attack. However,
  97.     # this is also the case for friendly skills such as heal. This script will fix
  98.     # it where if a battler targets an ally, no substitutes will take place.
  99.     #
  100.     # -----------------------------------------------------------------------------
  101.     # New Feature: Screen Resolution Size
  102.     # -----------------------------------------------------------------------------
  103.     # - The screen can now be resized from 544x416 with ease and still support maps
  104.     # that are smaller than 544x416. Maps smaller than 544x416 will be centered on
  105.     # the screen without having sprites jumping all over the place.
  106.     #
  107.     # -----------------------------------------------------------------------------
  108.     # New Feature: Adjust Animation Speed
  109.     # -----------------------------------------------------------------------------
  110.     # - RPG Maker VX Ace plays animations at a rate of 15 FPS by default. Speed up
  111.     # the animations by changing a simple constant in the module.
  112.     #
  113.     # -----------------------------------------------------------------------------
  114.     # New Feature: GUI Modifications
  115.     # -----------------------------------------------------------------------------
  116.     # - There are quite a lot of different modifications you can do to the GUI.
  117.     # This includes placing outlines around your gauges, changing the colours of
  118.     # each individual font aspect, and more. Also, you can change the default font
  119.     # setting for your games here.
  120.     #
  121.     # -----------------------------------------------------------------------------
  122.     # New Feature: Numeric Digit Grouping
  123.     # -----------------------------------------------------------------------------
  124.     # This will change various scenes to display numbers in groups where they are
  125.     # separated by a comma every three digits. Thus, a number like 1234567 will
  126.     # show up as 1,234,567. This allows for players to read numbers quicker.
  127.     #
  128.     # And that's all for the bug fixes and features!
  129.    #
  130.    #==============================================================================
  131.    # ▼ Instructions
  132.    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  133.    # To install this script, open up your script editor and copy/paste this script
  134.    # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  135.    #
  136.    #==============================================================================
  137.    # ▼ Compatibility
  138.    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  139.    # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  140.    # it will run with RPG Maker VX without adjusting.
  141.    #
  142.    #==============================================================================
  143.    
  144.    module YEA
  145.      module CORE
  146.      
  147.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  148.        # - Screen Resolution Size -
  149.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  150.        # RPG Maker VX Ace has the option of having larger width and height for
  151.        # your games. Resizing the width and height will have these changes:
  152.        #
  153.        #              Default   Resized   Min Tiles Default   Min Tiles New
  154.        #    Width       544       640           17                 20
  155.        #    Height      416       480           13                 15
  156.        #
  157.        # * Note: Maximum width is 640 while maximum height is 480.
  158.        #         Minimum width is 110 while maximum height is 10.
  159.        #         These are limitations set by RPG Maker VX Ace's engine.
  160.         #
  161.         # By selecting resize, all of the default menus will have their windows
  162.         # adjusted, but scripts provided by non-Yanfly Engine sources may or may
  163.         # not adjust themselves properly.
  164.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  165.         RESIZE_WIDTH  = 640
  166.         RESIZE_HEIGHT = 416
  167.        
  168.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  169.         # - Adjust Animation Speed -
  170.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  171.         # By default, the animation speed played in battles operates at 15 FPS
  172.         # (frames per second). For those who would like to speed it up, change this
  173.         # constant to one of these values:
  174.         #   RATE   Speed
  175.         #     4      15 fps
  176.         #     3      20 fps
  177.         #     2      30 fps
  178.         #     1      60 fps
  179.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  180.         ANIMATION_RATE = 3
  181.        
  182.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  183.         # - Digit Grouping -
  184.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  185.         # Setting this to true will cause numbers to be grouped together when they
  186.         # are larger than a thousand. For example, 12345 will appear as 12,345.
  187.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  188.         GROUP_DIGITS = true
  189.        
  190.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  191.         # - Font Settings -
  192.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  193.         # Adjust the default font settings for your game here. The various settings
  194.         # will be explained below.
  195.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  196.         FONT_NAME = ["VL Gothic", "Verdana", "Arial", "Courier"]
  197.         # This adjusts the fonts used for your game. If the font at the start of
  198.         # the array doesn't exist on the player's computer, it'll use the next one.
  199.        FONT_SIZE = 24       # Adjusts font size. Default: 24
  200.        FONT_BOLD = false   # Makes font bold. Default: false
  201.        FONT_ITALIC = false  # Makes font italic. Default: false
  202.        FONT_SHADOW = false  # Gives font a shadow. Default: false
  203.        FONT_OUTLINE = true  # Gives font an outline. Default: true
  204.        FONT_COLOUR = Color.new(255, 255, 255, 255)   # Default: 255, 255, 255, 255
  205.        FONT_OUTLINE_COLOUR = Color.new(0, 0, 0, 128) # Default:   0,   0,   0, 128
  206.      
  207.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  208.        # - Forced Action Settings -
  209.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  210.        # For those who would like to allow the game to remove a forced action
  211.        # battler from the queue list, use the switch below. If you don't want to
  212.         # use this option, set the switch ID to 0.
  213.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  214.         FORCED_ACTION_REMOVE_SWITCH = 0
  215.        
  216.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  217.         # - Gauge Appearance Settings -
  218.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  219.         # You can modify the way your gauges appear in the game. If you wish for
  220.         # them to have an outline, it's possible. You can also adjust the height
  221.        # of the gauges, too.
  222.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  223.        GAUGE_OUTLINE = true
  224.        GAUGE_HEIGHT = 12
  225.      
  226.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  227.        # - Held L and R Menu Scrolling -
  228.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  229.        # VX gave the ability to scroll through menus quickly through holding the
  230.        # L and R buttons (Q and W on the keyboard). VX Ace disabled it. Now, you
  231.        # can re-enable the ability to scroll faster by setting this constant to
  232.        # true. To disable it, set this constant to false.
  233.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  234.        QUICK_SCROLLING = true
  235.      
  236.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  237.        # - System Text Colours -
  238.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  239.        # Sometimes the system text colours are boring as just orange for HP, blue
  240.        # for MP, and green for TP. Change the values here. Each number corresponds
  241.        # to the colour index of the Window.png skin found in Graphics\System.
  242.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  243.        COLOURS ={
  244.        # :text       => ID
  245.          :normal     =>  0,   # Default:  0
  246.          :system     => 16,   # Default: 16
  247.          :crisis     => 17,   # Default: 17
  248.          :knockout   => 18,   # Default: 18
  249.          :gauge_back => 19,   # Default: 19
  250.          :hp_gauge1  => 28,   # Default: 20
  251.          :hp_gauge2  => 29,   # Default: 21
  252.          :mp_gauge1  => 22,   # Default: 22
  253.          :mp_gauge2  => 23,   # Default: 23
  254.          :mp_cost    => 23,   # Default: 23
  255.          :power_up   => 24,   # Default: 24
  256.          :power_down => 25,   # Default: 25
  257.          :tp_gauge1  => 10,   # Default: 28
  258.          :tp_gauge2  =>  2,   # Default: 29
  259.          :tp_cost    =>  2,   # Default: 29
  260.        } # Do not remove this.
  261.      
  262.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  263.        # - System Text Options -
  264.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  265.        # Here, you can adjust the transparency used for disabled items, the %
  266.        # needed for HP and MP to enter "crisis" mode.
  267.        #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  268.        TRANSPARENCY = 160   # Adjusts transparency of disabled items. Default: 160
  269.        HP_CRISIS = 0.25     # When HP is considered critical. Default: 0.25
  270.        MP_CRISIS = 0.25     # When MP is considered critical. Default: 0.25
  271.        ITEM_AMOUNT = "×%s"  # The prefix used for item amounts.
  272.      
  273.      end # CORE
  274.    end # YEA
  275.    
  276.    #==============================================================================
  277.    # ▼ Editting anything past this point may potentially result in causing
  278.    # computer damage, incontinence, explosion of user's head, coma, death, and/or
  279.     # halitosis so edit at your own risk.
  280.     #==============================================================================
  281.      
  282.     Graphics.resize_screen(YEA::CORE::RESIZE_WIDTH, YEA::CORE::RESIZE_HEIGHT)
  283.     Font.default_name = YEA::CORE::FONT_NAME
  284.     Font.default_size = YEA::CORE::FONT_SIZE
  285.     Font.default_bold = YEA::CORE::FONT_BOLD
  286.     Font.default_italic = YEA::CORE::FONT_ITALIC
  287.     Font.default_shadow = YEA::CORE::FONT_SHADOW
  288.     Font.default_outline = YEA::CORE::FONT_OUTLINE
  289.     Font.default_color = YEA::CORE::FONT_COLOUR
  290.     Font.default_out_color = YEA::CORE::FONT_OUTLINE_COLOUR
  291.      
  292.     #==============================================================================
  293.     # ■ Numeric
  294.     #==============================================================================
  295.      
  296.     class Numeric  
  297.      
  298.       #--------------------------------------------------------------------------
  299.       # new method: group_digits
  300.       #--------------------------------------------------------------------------
  301.       def group
  302.         return self.to_s unless YEA::CORE::GROUP_DIGITS
  303.         self.to_s.gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/,'\1,\2')
  304.       end
  305.      
  306.     end # Numeric
  307.      
  308.     #==============================================================================
  309.     # ■ Switch
  310.     #==============================================================================
  311.      
  312.     module Switch
  313.      
  314.       #--------------------------------------------------------------------------
  315.       # self.forced_action_remove
  316.       #--------------------------------------------------------------------------
  317.       def self.forced_action_remove
  318.         return false if YEA::CORE::FORCED_ACTION_REMOVE_SWITCH <= 0
  319.         return $game_switches[YEA::CORE::FORCED_ACTION_REMOVE_SWITCH]
  320.       end
  321.      
  322.     end # Switch
  323.      
  324.     #==============================================================================
  325.     # ■ BattleManager
  326.     #==============================================================================
  327.      
  328.     module BattleManager
  329.      
  330.       #--------------------------------------------------------------------------
  331.       # overwrite method: turn_start
  332.       #--------------------------------------------------------------------------
  333.       def self.turn_start
  334.         @phase = :turn
  335.         clear_actor
  336.         $game_troop.increase_turn
  337.         @performed_battlers = []
  338.         make_action_orders
  339.       end
  340.      
  341.       #--------------------------------------------------------------------------
  342.       # overwrite method: next_subject
  343.       #--------------------------------------------------------------------------
  344.       def self.next_subject
  345.         @performed_battlers = [] if @performed_battlers.nil?
  346.         loop do
  347.           @action_battlers -= @performed_battlers
  348.           battler = @action_battlers.shift
  349.           return nil unless battler
  350.           next unless battler.index && battler.alive?
  351.           @performed_battlers.push(battler)
  352.           return battler
  353.         end
  354.       end
  355.      
  356.       #--------------------------------------------------------------------------
  357.       # overwrite method: force_action
  358.       #--------------------------------------------------------------------------
  359.       def self.force_action(battler)
  360.         @action_forced = [] if @action_forced == nil
  361.         @action_forced.push(battler)
  362.         return unless Switch.forced_action_remove
  363.         @action_battlers.delete(battler)
  364.       end
  365.      
  366.       #--------------------------------------------------------------------------
  367.       # overwrite method: action_forced?
  368.       #--------------------------------------------------------------------------
  369.       def self.action_forced?
  370.         @action_forced != nil
  371.       end
  372.      
  373.       #--------------------------------------------------------------------------
  374.       # overwrite method: action_forced_battler
  375.       #--------------------------------------------------------------------------
  376.       def self.action_forced_battler
  377.         @action_forced.shift
  378.       end
  379.      
  380.       #--------------------------------------------------------------------------
  381.       # overwrite method: clear_action_force
  382.       #--------------------------------------------------------------------------
  383.       def self.clear_action_force
  384.         @action_forced = nil if @action_forced.empty?
  385.       end
  386.      
  387.     end # BattleManager
  388.      
  389.     #==============================================================================
  390.     # ■ Game_Battler
  391.     #==============================================================================
  392.      
  393.     class Game_Battler < Game_BattlerBase
  394.      
  395.       #--------------------------------------------------------------------------
  396.       # public instance variables
  397.       #--------------------------------------------------------------------------
  398.       attr_accessor :pseudo_ani_id
  399.      
  400.       #--------------------------------------------------------------------------
  401.       # alias method: clear_sprite_effects
  402.       #--------------------------------------------------------------------------
  403.       alias game_battler_clear_sprite_effects_ace clear_sprite_effects
  404.       def clear_sprite_effects
  405.         game_battler_clear_sprite_effects_ace
  406.         @pseudo_ani_id = 0
  407.       end
  408.      
  409.       #--------------------------------------------------------------------------
  410.       # alias method: force_action
  411.       #--------------------------------------------------------------------------
  412.       alias game_battler_force_action_ace force_action
  413.       def force_action(skill_id, target_index)
  414.         clone_current_actions
  415.         game_battler_force_action_ace(skill_id, target_index)
  416.       end
  417.      
  418.       #--------------------------------------------------------------------------
  419.       # new method: clone_current_actions
  420.       #--------------------------------------------------------------------------
  421.       def clone_current_actions
  422.         @cloned_actions = @actions.dup
  423.       end
  424.      
  425.       #--------------------------------------------------------------------------
  426.       # new method: restore_cloned_actions
  427.       #--------------------------------------------------------------------------
  428.       def restore_cloned_actions
  429.         return if @cloned_actions.nil?
  430.         @actions = @cloned_actions.dup
  431.         @cloned_actions = nil
  432.       end
  433.      
  434.       #--------------------------------------------------------------------------
  435.       # alias method: on_action_end
  436.       #--------------------------------------------------------------------------
  437.       alias game_battler_on_action_end_ace on_action_end
  438.       def on_action_end
  439.         game_battler_on_action_end_ace
  440.         restore_cloned_actions
  441.       end
  442.      
  443.       #--------------------------------------------------------------------------
  444.       # alias method: on_battle_end
  445.       #--------------------------------------------------------------------------
  446.       alias game_battler_on_battle_end_ace on_battle_end
  447.       def on_battle_end
  448.         game_battler_on_battle_end_ace
  449.         @cloned_actions = nil
  450.       end
  451.      
  452.     end # Game_Battler
  453.      
  454.     #==============================================================================
  455.     # ■ Game_Troop
  456.     #==============================================================================
  457.      
  458.     class Game_Troop < Game_Unit
  459.      
  460.       #--------------------------------------------------------------------------
  461.       # overwrite method: setup
  462.       #--------------------------------------------------------------------------
  463.       def setup(troop_id)
  464.         clear
  465.         @troop_id = troop_id
  466.         @enemies = []
  467.         troop.members.each do |member|
  468.           next unless $data_enemies[member.enemy_id]
  469.           enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
  470.           enemy.hide if member.hidden
  471.           enemy.screen_x = member.x + (Graphics.width - 544)/2
  472.           enemy.screen_y = member.y + (Graphics.height - 416)
  473.           @enemies.push(enemy)
  474.         end
  475.         init_screen_tone
  476.         make_unique_names
  477.       end
  478.      
  479.     end # Game_Troop
  480.      
  481.     #==============================================================================
  482.     # ■ Game_Map
  483.     #==============================================================================
  484.      
  485.     class Game_Map
  486.      
  487.       #--------------------------------------------------------------------------
  488.       # overwrite method: scroll_down
  489.       #--------------------------------------------------------------------------
  490.       def scroll_down(distance)
  491.         if loop_vertical?
  492.           @display_y += distance
  493.           @display_y %= @map.height * 256
  494.           @parallax_y += distance if @parallax_loop_y
  495.         else
  496.           last_y = @display_y
  497.           dh = Graphics.height > height * 32 ? height : screen_tile_y
  498.           @display_y = [@display_y + distance, height - dh].min
  499.           @parallax_y += @display_y - last_y
  500.         end
  501.       end
  502.      
  503.       #--------------------------------------------------------------------------
  504.       # overwrite method: scroll_right
  505.       #--------------------------------------------------------------------------
  506.       def scroll_right(distance)
  507.         if loop_horizontal?
  508.           @display_x += distance
  509.           @display_x %= @map.width * 256
  510.           @parallax_x += distance if @parallax_loop_x
  511.         else
  512.           last_x = @display_x
  513.           dw = Graphics.width > width * 32 ? width : screen_tile_x
  514.           @display_x = [@display_x + distance, width - dw].min
  515.           @parallax_x += @display_x - last_x
  516.         end
  517.       end
  518.      
  519.     end # Game_Map
  520.      
  521.     #==============================================================================
  522.     # ■ Game_Event
  523.     #==============================================================================
  524.      
  525.     class Game_Event < Game_Character
  526.      
  527.       #--------------------------------------------------------------------------
  528.       # overwrite method: near_the_screen?
  529.       #--------------------------------------------------------------------------
  530.       def near_the_screen?(dx = nil, dy = nil)
  531.         dx = [Graphics.width, $game_map.width * 256].min/32 - 5 if dx.nil?
  532.         dy = [Graphics.height, $game_map.height * 256].min/32 - 5 if dy.nil?
  533.         ax = $game_map.adjust_x(@real_x) - Graphics.width / 2 / 32
  534.         ay = $game_map.adjust_y(@real_y) - Graphics.height / 2 / 32
  535.         ax >= -dx && ax <= dx && ay >= -dy && ay <= dy
  536.       end
  537.      
  538.     end # Game_Event
  539.      
  540.     #==============================================================================
  541.     # ■ Sprite_Base
  542.     #==============================================================================
  543.      
  544.     class Sprite_Base < Sprite
  545.      
  546.       #--------------------------------------------------------------------------
  547.       # overwrite method: set_animation_rate
  548.       #--------------------------------------------------------------------------
  549.       def set_animation_rate
  550.         @ani_rate = YEA::CORE::ANIMATION_RATE
  551.       end
  552.      
  553.       #--------------------------------------------------------------------------
  554.       # new method: start_pseudo_animation
  555.       #--------------------------------------------------------------------------
  556.       def start_pseudo_animation(animation, mirror = false)
  557.         dispose_animation
  558.         @animation = animation
  559.         return if @animation.nil?
  560.         @ani_mirror = mirror
  561.         set_animation_rate
  562.         @ani_duration = @animation.frame_max * @ani_rate + 1
  563.         @ani_sprites = []
  564.       end
  565.      
  566.     end # Sprite_Base
  567.      
  568.     #==============================================================================
  569.     # ■ Sprite_Battler
  570.     #==============================================================================
  571.      
  572.     class Sprite_Battler < Sprite_Base
  573.      
  574.       #--------------------------------------------------------------------------
  575.       # alias method: setup_new_animation
  576.       #--------------------------------------------------------------------------
  577.       alias sprite_battler_setup_new_animation_ace setup_new_animation
  578.       def setup_new_animation
  579.         sprite_battler_setup_new_animation_ace
  580.         return if @battler.nil?
  581.         return if @battler.pseudo_ani_id.nil?
  582.         return if @battler.pseudo_ani_id <= 0
  583.         animation = $data_animations[@battler.pseudo_ani_id]
  584.         mirror = @battler.animation_mirror
  585.         start_pseudo_animation(animation, mirror)
  586.         @battler.pseudo_ani_id = 0
  587.       end
  588.      
  589.     end # Sprite_Battler
  590.      
  591.     #==============================================================================
  592.     # ■ Spriteset_Map
  593.     #==============================================================================
  594.      
  595.     class Spriteset_Map
  596.      
  597.       #--------------------------------------------------------------------------
  598.       # overwrite method: create_viewports
  599.       #--------------------------------------------------------------------------
  600.       def create_viewports
  601.         if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
  602.           dx = (Graphics.width - $game_map.width * 32) / 2
  603.         else
  604.           dx = 0
  605.         end
  606.         dw = [Graphics.width, $game_map.width * 32].min
  607.         dw = Graphics.width if $game_map.loop_horizontal?
  608.         if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
  609.           dy = (Graphics.height - $game_map.height * 32) / 2
  610.         else
  611.           dy = 0
  612.         end
  613.         dh = [Graphics.height, $game_map.height * 32].min
  614.         dh = Graphics.height if $game_map.loop_vertical?
  615.         @viewport1 = Viewport.new(dx, dy, dw, dh)
  616.         @viewport2 = Viewport.new(dx, dy, dw, dh)
  617.         @viewport3 = Viewport.new(dx, dy, dw, dh)
  618.         @viewport2.z = 50
  619.         @viewport3.z = 100
  620.       end
  621.      
  622.       #--------------------------------------------------------------------------
  623.       # new method: update_viewport_sizes
  624.       #--------------------------------------------------------------------------
  625.       def update_viewport_sizes
  626.         if Graphics.width > $game_map.width * 32 && !$game_map.loop_horizontal?
  627.           dx = (Graphics.width - $game_map.width * 32) / 2
  628.         else
  629.           dx = 0
  630.         end
  631.         dw = [Graphics.width, $game_map.width * 32].min
  632.         dw = Graphics.width if $game_map.loop_horizontal?
  633.         if Graphics.height > $game_map.height * 32 && !$game_map.loop_vertical?
  634.           dy = (Graphics.height - $game_map.height * 32) / 2
  635.         else
  636.           dy = 0
  637.         end
  638.         dh = [Graphics.height, $game_map.height * 32].min
  639.         dh = Graphics.height if $game_map.loop_vertical?
  640.         rect = Rect.new(dx, dy, dw, dh)
  641.         for viewport in [@viewport1, @viewport2, @viewport3]
  642.           viewport.rect = rect
  643.         end
  644.       end
  645.      
  646.     end # Spriteset_Map
  647.      
  648.     #==============================================================================
  649.     # ■ Window_Base
  650.     #==============================================================================
  651.      
  652.     class Window_Base < Window
  653.      
  654.       #--------------------------------------------------------------------------
  655.       # overwrite method: reset_font_settings
  656.       #--------------------------------------------------------------------------
  657.       def reset_font_settings
  658.         change_color(normal_color)
  659.         contents.font.size = Font.default_size
  660.         contents.font.bold = Font.default_bold
  661.         contents.font.italic = Font.default_italic
  662.         contents.font.out_color = Font.default_out_color
  663.       end
  664.      
  665.       #--------------------------------------------------------------------------
  666.       # overwrite methods: color
  667.       #--------------------------------------------------------------------------
  668.       def normal_color;      text_color(YEA::CORE::COLOURS[:normal]);      end;
  669.       def system_color;      text_color(YEA::CORE::COLOURS[:system]);      end;
  670.       def crisis_color;      text_color(YEA::CORE::COLOURS[:crisis]);      end;
  671.       def knockout_color;    text_color(YEA::CORE::COLOURS[:knockout]);    end;
  672.       def gauge_back_color;  text_color(YEA::CORE::COLOURS[:gauge_back]);  end;
  673.       def hp_gauge_color1;   text_color(YEA::CORE::COLOURS[:hp_gauge1]);   end;
  674.       def hp_gauge_color2;   text_color(YEA::CORE::COLOURS[:hp_gauge2]);   end;
  675.       def mp_gauge_color1;   text_color(YEA::CORE::COLOURS[:mp_gauge1]);   end;
  676.       def mp_gauge_color2;   text_color(YEA::CORE::COLOURS[:mp_gauge2]);   end;
  677.       def mp_cost_color;     text_color(YEA::CORE::COLOURS[:mp_cost]);     end;
  678.       def power_up_color;    text_color(YEA::CORE::COLOURS[:power_up]);    end;
  679.       def power_down_color;  text_color(YEA::CORE::COLOURS[:power_down]);  end;
  680.       def tp_gauge_color1;   text_color(YEA::CORE::COLOURS[:tp_gauge1]);   end;
  681.       def tp_gauge_color2;   text_color(YEA::CORE::COLOURS[:tp_gauge2]);   end;
  682.       def tp_cost_color;     text_color(YEA::CORE::COLOURS[:tp_cost]);     end;
  683.      
  684.       #--------------------------------------------------------------------------
  685.       # overwrite method: translucent_alpha
  686.       #--------------------------------------------------------------------------
  687.       def translucent_alpha
  688.         return YEA::CORE::TRANSPARENCY
  689.       end
  690.      
  691.       #--------------------------------------------------------------------------
  692.       # overwrite method: hp_color
  693.       #--------------------------------------------------------------------------
  694.       def hp_color(actor)
  695.         return knockout_color if actor.hp == 0
  696.         return crisis_color if actor.hp < actor.mhp * YEA::CORE::HP_CRISIS
  697.         return normal_color
  698.       end
  699.       #--------------------------------------------------------------------------
  700.       # overwrite method: mp_color
  701.       #--------------------------------------------------------------------------
  702.       def mp_color(actor)
  703.         return crisis_color if actor.mp < actor.mmp * YEA::CORE::MP_CRISIS
  704.         return normal_color
  705.       end
  706.      
  707.       #--------------------------------------------------------------------------
  708.       # overwrite method: draw_gauge
  709.       #--------------------------------------------------------------------------
  710.       def draw_gauge(dx, dy, dw, rate, color1, color2)
  711.         dw -= 2 if YEA::CORE::GAUGE_OUTLINE
  712.         fill_w = [(dw * rate).to_i, dw].min
  713.         gauge_h = YEA::CORE::GAUGE_HEIGHT
  714.         gauge_y = dy + line_height - 2 - gauge_h
  715.         if YEA::CORE::GAUGE_OUTLINE
  716.           outline_colour = gauge_back_color
  717.           outline_colour.alpha = translucent_alpha
  718.           contents.fill_rect(dx, gauge_y-1, dw+2, gauge_h+2, outline_colour)
  719.           dx += 1
  720.         end
  721.         contents.fill_rect(dx, gauge_y, dw, gauge_h, gauge_back_color)
  722.         contents.gradient_fill_rect(dx, gauge_y, fill_w, gauge_h, color1, color2)
  723.       end
  724.      
  725.       #--------------------------------------------------------------------------
  726.       # overwrite method: draw_actor_level
  727.       #--------------------------------------------------------------------------
  728.       def draw_actor_level(actor, dx, dy)
  729.         change_color(system_color)
  730.         draw_text(dx, dy, 32, line_height, Vocab::level_a)
  731.         change_color(normal_color)
  732.         draw_text(dx + 32, dy, 24, line_height, actor.level.group, 2)
  733.       end
  734.      
  735.       #--------------------------------------------------------------------------
  736.       # overwrite method: draw_current_and_max_values
  737.       #--------------------------------------------------------------------------
  738.       def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  739.         total = current.group + "/" + max.group
  740.         if dw < text_size(total).width + text_size(Vocab.hp).width
  741.           change_color(color1)
  742.           draw_text(dx, dy, dw, line_height, current.group, 2)
  743.         else
  744.           xr = dx + text_size(Vocab.hp).width
  745.           dw -= text_size(Vocab.hp).width
  746.           change_color(color2)
  747.           text = "/" + max.group
  748.           draw_text(xr, dy, dw, line_height, text, 2)
  749.           dw -= text_size(text).width
  750.           change_color(color1)
  751.           draw_text(xr, dy, dw, line_height, current.group, 2)
  752.         end
  753.       end
  754.      
  755.       #--------------------------------------------------------------------------
  756.       # overwrite method: draw_actor_tp
  757.       #--------------------------------------------------------------------------
  758.       def draw_actor_tp(actor, x, y, width = 124)
  759.         draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  760.         change_color(system_color)
  761.         draw_text(x, y, 30, line_height, Vocab::tp_a)
  762.         change_color(tp_color(actor))
  763.         draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i.group, 2)
  764.       end
  765.      
  766.       #--------------------------------------------------------------------------
  767.       # overwrite method: draw_actor_param
  768.       #--------------------------------------------------------------------------
  769.       def draw_actor_param(actor, x, y, param_id)
  770.         change_color(system_color)
  771.         draw_text(x, y, 120, line_height, Vocab::param(param_id))
  772.         change_color(normal_color)
  773.         draw_text(x + 120, y, 36, line_height, actor.param(param_id).group, 2)
  774.       end
  775.      
  776.       #--------------------------------------------------------------------------
  777.       # overwrite method: draw_currency_value
  778.       #--------------------------------------------------------------------------
  779.       def draw_currency_value(value, unit, x, y, width)
  780.         cx = text_size(unit).width
  781.         change_color(normal_color)
  782.         draw_text(x, y, width - cx - 2, line_height, value.group, 2)
  783.         change_color(system_color)
  784.         draw_text(x, y, width, line_height, unit, 2)
  785.       end
  786.      
  787.       #--------------------------------------------------------------------------
  788.       # overwrite method: draw_actor_simple_status
  789.       #--------------------------------------------------------------------------
  790.       def draw_actor_simple_status(actor, dx, dy)
  791.         draw_actor_name(actor, dx, dy)
  792.         draw_actor_level(actor, dx, dy + line_height * 1)
  793.         draw_actor_icons(actor, dx, dy + line_height * 2)
  794.         dw = contents.width - dx - 124
  795.         draw_actor_class(actor, dx + 120, dy, dw)
  796.         draw_actor_hp(actor, dx + 120, dy + line_height * 1, dw)
  797.         draw_actor_mp(actor, dx + 120, dy + line_height * 2, dw)
  798.       end
  799.      
  800.     end # Window_Base
  801.      
  802.     #==============================================================================
  803.     # ■ Window_Selectable
  804.     #==============================================================================
  805.      
  806.     class Window_Selectable < Window_Base
  807.      
  808.       #--------------------------------------------------------------------------
  809.       # overwrite method: process_cursor_move
  810.       #--------------------------------------------------------------------------
  811.       if YEA::CORE::QUICK_SCROLLING
  812.       def process_cursor_move
  813.         return unless cursor_movable?
  814.         last_index = @index
  815.         cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  816.         cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  817.         cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  818.         cursor_left (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  819.         cursor_pagedown   if !handle?(:pagedown) && Input.repeat?(:R)
  820.         cursor_pageup     if !handle?(:pageup)   && Input.repeat?(:L)
  821.         Sound.play_cursor if @index != last_index
  822.       end
  823.       end # YEA::CORE::QUICK_SCROLLING
  824.      
  825.     end # Window_Selectable
  826.      
  827.     #==============================================================================
  828.     # ■ Window_ItemList
  829.     #==============================================================================
  830.      
  831.     class Window_ItemList < Window_Selectable
  832.      
  833.       #--------------------------------------------------------------------------
  834.       # overwrite method: draw_item
  835.       #--------------------------------------------------------------------------
  836.       def draw_item(index)
  837.         item = @data[index]
  838.         return if item.nil?
  839.         rect = item_rect(index)
  840.         rect.width -= 4
  841.         draw_item_name(item, rect.x, rect.y, enable?(item), rect.width - 24)
  842.         draw_item_number(rect, item)
  843.       end
  844.      
  845.       #--------------------------------------------------------------------------
  846.       # overwrite method: draw_item_number
  847.       #--------------------------------------------------------------------------
  848.       def draw_item_number(rect, item)
  849.         text = sprintf(YEA::CORE::ITEM_AMOUNT, $game_party.item_number(item).group)
  850.         draw_text(rect, text, 2)
  851.       end
  852.      
  853.     end # Window_ItemList
  854.      
  855.     #==============================================================================
  856.     # ■ Window_SkillList
  857.     #==============================================================================
  858.      
  859.     class Window_SkillList < Window_Selectable
  860.      
  861.       #--------------------------------------------------------------------------
  862.       # draw_item
  863.       #--------------------------------------------------------------------------
  864.       def draw_item(index)
  865.         skill = @data[index]
  866.         return if skill.nil?
  867.         rect = item_rect(index)
  868.         rect.width -= 4
  869.         draw_item_name(skill, rect.x, rect.y, enable?(skill), rect.width - 24)
  870.         draw_skill_cost(rect, skill)
  871.       end
  872.      
  873.     end # Window_SkillList
  874.      
  875.     #==============================================================================
  876.     # ■ Window_Status
  877.     #==============================================================================
  878.      
  879.     class Window_Status < Window_Selectable
  880.      
  881.       #--------------------------------------------------------------------------
  882.       # overwrite method: draw_exp_info
  883.       #--------------------------------------------------------------------------
  884.       def draw_exp_info(x, y)
  885.         s1 = @actor.max_level? ? "-------" : @actor.exp
  886.         s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp
  887.         s_next = sprintf(Vocab::ExpNext, Vocab::level)
  888.         change_color(system_color)
  889.         draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
  890.         draw_text(x, y + line_height * 2, 180, line_height, s_next)
  891.         change_color(normal_color)
  892.         s1 = s1.group if s1.is_a?(Integer)
  893.         s2 = s2.group if s2.is_a?(Integer)
  894.         draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
  895.         draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
  896.       end
  897.      
  898.     end # Window_Status
  899.      
  900.     #==============================================================================
  901.     # ■ Window_ShopBuy
  902.     #==============================================================================
  903.      
  904.     class Window_ShopBuy < Window_Selectable
  905.      
  906.       #--------------------------------------------------------------------------
  907.       # overwrite method: draw_item
  908.       #--------------------------------------------------------------------------
  909.       def draw_item(index)
  910.         item = @data[index]
  911.         rect = item_rect(index)
  912.         draw_item_name(item, rect.x, rect.y, enable?(item))
  913.         rect.width -= 4
  914.         draw_text(rect, price(item).group, 2)
  915.       end
  916.      
  917.     end # Window_ShopBuy
  918.      
  919.     #==============================================================================
  920.     # ■ Scene_Map
  921.     #==============================================================================
  922.      
  923.     class Scene_Map < Scene_Base
  924.      
  925.       #--------------------------------------------------------------------------
  926.       # alias method: post_transfer
  927.       #--------------------------------------------------------------------------
  928.       alias scene_map_post_transfer_ace post_transfer
  929.       def post_transfer
  930.         @spriteset.update_viewport_sizes
  931.         scene_map_post_transfer_ace
  932.       end
  933.      
  934.     end # Scene_Map
  935.      
  936.     #==============================================================================
  937.     # ■ Scene_Battle
  938.     #==============================================================================
  939.      
  940.     class Scene_Battle < Scene_Base
  941.      
  942.       #--------------------------------------------------------------------------
  943.       # alias method: check_substitute
  944.       #--------------------------------------------------------------------------
  945.       alias scene_battle_check_substitute_ace check_substitute
  946.       def check_substitute(target, item)
  947.         return false if @subject.actor? == target.actor?
  948.         return scene_battle_check_substitute_ace(target, item)
  949.       end
  950.      
  951.       #--------------------------------------------------------------------------
  952.       # overwrite method: process_forced_action
  953.       #--------------------------------------------------------------------------
  954.       def process_forced_action
  955.         while BattleManager.action_forced?
  956.           last_subject = @subject
  957.           @subject = BattleManager.action_forced_battler
  958.           process_action
  959.           @subject = last_subject
  960.           BattleManager.clear_action_force
  961.         end
  962.       end
  963.      
  964.       #--------------------------------------------------------------------------
  965.       # overwrite method: show_attack_animation
  966.       #--------------------------------------------------------------------------
  967.       def show_attack_animation(targets)
  968.         if @subject.actor?
  969.           show_normal_animation(targets, @subject.atk_animation_id1, false)
  970.           wait_for_animation
  971.           show_normal_animation(targets, @subject.atk_animation_id2, true)
  972.         else
  973.           Sound.play_enemy_attack
  974.           abs_wait_short
  975.         end
  976.       end
  977.      
  978.       #--------------------------------------------------------------------------
  979.       # overwrite method: show_normal_animation
  980.       #--------------------------------------------------------------------------
  981.       def show_normal_animation(targets, animation_id, mirror = false)
  982.         animation = $data_animations[animation_id]
  983.         return if animation.nil?
  984.         ani_check = false
  985.         targets.each do |target|
  986.           if ani_check && target.animation_id <= 0
  987.             target.pseudo_ani_id = animation_id
  988.           else
  989.             target.animation_id = animation_id
  990.           end
  991.           target.animation_mirror = mirror
  992.           abs_wait_short unless animation.to_screen?
  993.           ani_check = true if animation.to_screen?
  994.         end
  995.         abs_wait_short if animation.to_screen?
  996.       end
  997.      
  998.     end # Scene_Battle
  999.      
  1000.     #==============================================================================
  1001.     #
  1002.     # ▼ End of File
  1003.     #
  1004.     #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement