Advertisement
Archeia

Yanfly Engine Ace - Ace Core Engine v1.09

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