Advertisement
modern_algebra

Terrain Features 1.0.0

Feb 3rd, 2013
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 22.62 KB | None | 0 0
  1. #==============================================================================
  2. #    Terrain Features
  3. #    Version: 1.0.0
  4. #    Author: modern algebra (rmrk.net)
  5. #    Date: 3 February 2013
  6. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  7. #  Description:
  8. #    
  9. #    By default, the terrain tags in RMVX Ace are almost useless. This script
  10. #   makes it so that you can give terrains a number of features, such as:
  11. #   changing the rate of encounters; changing the chance for preemptive and
  12. #   surprise attacks; changing the battleback; changing movement speed;
  13. #   setting a footstep sound; and more. Read the Editable Region at line 100
  14. #   for a full list.
  15. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  16. #  Instructions:
  17. #    
  18. #    Paste this script into its own slot in the Script Editor, above Main but
  19. #   below Materials. If you are using my Boat/Ship Passability for Events
  20. #   script, then this script should be BELOW that one in the Script Editor.
  21. #``````````````````````````````````````````````````````````````````````````````
  22. #  Terrain Features:
  23. #
  24. #    When it comes to the actual terrain features themselves, they are setup
  25. #   in the Editable Region at line 100. Please review them there to get an idea
  26. #   of what each does and how to set them up. In brief, however, the features
  27. #   are:
  28. #
  29. #        :battleback_1            :battleback_2           :encounter_rate
  30. #        :preemptive_rate         :surprise_rate          :disable_dash
  31. #        :walk_speed              :boat_speed             :ship_speed
  32. #        :airship_speed           :boat_passable          :ship_passable
  33. #        :airship_land_ok         :walk_se                :boat_se
  34. #        :ship_se                 :airship_se             :se_random_pitch
  35. #                                 :common_event_id
  36. #``````````````````````````````````````````````````````````````````````````````
  37. #  Substitute Terrains:
  38. #
  39. #    Naturally, you setup terrain tags on your tileset directly, just as you do
  40. #   ordinarily, and you access them through the Get Location Data event command
  41. #   on the third page, just as you do ordinarily. Similarly, you are still
  42. #   limited to 8 terrain tags per tilemap.
  43. #
  44. #    The only thing this script adds on that front is the ability to substitute
  45. #   some terrain tags for different tilemaps. Say, for instance, you have
  46. #   configured your world map and, in the course of doing so, you have used all
  47. #   8 terrain tags. Now, you are making a cave map and you want to use new
  48. #   terrain types. In that case, you can put the following code into the
  49. #   notebox of the tilemap:
  50. #
  51. #      \sub_terrain[id_1 = new_id_1; id_2 = new_id_2; ... id_n = new_id_n]
  52. #
  53. #   where id_n and new_id_n are both integers. new_id_n will be substituted
  54. #   wherever you set id_n. What this means in practice is that you can
  55. #   reservice some of your other terrain tags in a new tilemap. Wherever you
  56. #   set id_n as the terrain tag, it will instead be received as new_id_n.
  57. #
  58. #  EXAMPLE:
  59. #
  60. #      \sub_terrain[1 = 8; 2 = 9]
  61. #
  62. #    In this tilemap, wherever you tag the terrain as 1, it will instead be 8,
  63. #   and wherever you tag the terrain as 2, it will instead be 9. Thus, even
  64. #   though 1 and 2 are being used, say for water tiles, you can give to
  65. #   terrains 8 and 9 a number of different attributes, and the tiles tagged as
  66. #   1 or 2 in this tilemap will instead have the attributes of terrains 8 or 9.
  67. #==============================================================================
  68.  
  69. $imported = {} unless $imported
  70. $imported[:"MA_TerrainFeatures 1.0.x"] = true
  71.  
  72. #==============================================================================
  73. # *** Terrain Features
  74. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  75. #  This is the configuration module for all terrain features
  76. #==============================================================================
  77.  
  78. module MA_TerrainFeatures
  79.   #==========================================================================
  80.   # ** Data_TerrainFeature
  81.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  82.   #  A Struct that holds all relevant attributes of a terrain type
  83.   #==========================================================================
  84.  
  85.   Data_Terrain = Struct.new(:battleback_1, :battleback_2, :encounter_rate,
  86.     :preemptive_rate, :surprise_rate, :disable_dash, :walk_speed, :boat_speed,
  87.     :ship_speed, :airship_speed, :boat_passable, :ship_passable,
  88.     :airship_land_ok, :walk_se, :boat_se, :ship_se, :airship_se,
  89.     :se_random_pitch, :common_event_id)
  90.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  91.   # * Terrain Data
  92.   #    Initializes a Data_Terrain object for the specified terrain_id
  93.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  94.   def self.terrain_data(terrain_id)
  95.     t = Data_Terrain.new
  96.     t.members.each { |feature| t[feature] = default_value_for(feature) }
  97.     se = RPG::SE
  98.     case terrain_id
  99.     #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  100.     #  BEGIN Editable Region
  101.     #````````````````````````````````````````````````````````````````````````
  102.     #  This is where you set the terrain features. The when x line identifies
  103.     # which terrain tag's features you are editing. Each possible feature is
  104.     # detailed below, and the number given next to it is its default value. If
  105.     # you do not include that line in the setting, that is the value it will
  106.     # have.
  107.     #
  108.     #  when 0 # Terrain Tag: 0
  109.     #    t.encounter_rate = 100
  110.     #        This value is the percentage by which walking on this terrain
  111.     #        increases your encounter gauge. Note that bush terrains already
  112.     #        get a 200% boost in encounters, and this is multiplied to that.
  113.     #    t.preemptive_rate = 100
  114.     #        This value is the percentage by which walking on this terrain
  115.     #        increases the chance the party will get a preemptive strike.
  116.     #    t.surprise_rate = 100
  117.     #        This value is the percentage by which walking on this terrain
  118.     #        increases the chance the party will be ambushed.
  119.     #    t.battleback_1 = nil
  120.     #        This value overrides the default battleback 1 when on this
  121.     #        terrain. It should be a string, set to the filename of the graphic
  122.     #        you want to use. If nil, the normal battleback 1 is used.
  123.     #    t.battleback_2 = nil
  124.     #        Same as t.battleback_1, but for battleback 2.
  125.     #    t.disable_dash = false
  126.     #        If set to true, dash will be disabled on this terrain.
  127.     #    t.walk_speed = 0
  128.     #        This value is added to the walk speed of any character walking on
  129.     #        the tile. So, if this is -1, the player will be slowed down by one
  130.     #        setting when walking on this terrain.
  131.     #    t.boat_speed = 0
  132.     #        Same as t.walk_speed, but it applies to boats.
  133.     #    t.ship_speed = 0
  134.     #        Same as t.walk_speed, but it applies to ships.
  135.     #    t.airship_speed = 0
  136.     #        Same as t.walk_speed, but it applies to airships.
  137.     #    t.boat_passable = nil
  138.     #        If set to true or false, this overrides ordinary passability
  139.     #        settings and will make the tile passable if in a boat. If nil,
  140.     #        then the terrain has no effect on boat passability.
  141.     #    t.ship_passable = nil
  142.     #        Same as t.boat_passable, but it applies to ships.
  143.     #    t.airship_land_ok = nil
  144.     #        Same as t.boat_passable, but it applies to whether the airship can
  145.     #        land, not to passability.
  146.     #    t.walk_se = nil
  147.     #        The sound effect played when the player walks on this terrain. It
  148.     #        is set as:
  149.     #          t.walk_se = se.new("Filename", 80, 100)
  150.     #        Replace 80 with the desired volume and 100 with desired pitch.
  151.     #        When nil, no SE is played.
  152.     #    t.boat_se = nil
  153.     #        Same as t.walk_se, but applies when crossing terrain in boat
  154.     #    t.ship_se = nil
  155.     #        Same as t.walk_se, but applies when crossing terrain in ship
  156.     #    t.airship_se = nil
  157.     #        Same as t.walk_se, but applies when crossing terrain in airship
  158.     #    t.se_random_pitch = nil
  159.     #        This value lets you set a range to randomize the pitch of the se
  160.     #        played when crossing the terrain. It is set as:
  161.     #          t.se_random_pitch = 70..125
  162.     #        Replace 70 with the lowest pitch you want and replace 125 with the
  163.     #        highest pitch in the range. If nil, the pitch will not be
  164.     #        randomized
  165.     #    t.common_event_id = 0
  166.     #        This is the ID of a common event that is called every time the
  167.     #        player accesses this terrain. Any common event called in this
  168.     #        way should never require more than 1 frame to execute fully.
  169.     #````````````````````````````````````````````````````````````````````````
  170.     #  EXAMPLE 1:
  171.     #
  172.     #  when 4 # Terrain Tag: 4
  173.     #    t.encounter_rate = 150
  174.     #    t.surprise_rate = 200
  175.     #    t.battleback_1 = "DirtField"
  176.     #    t.battleback_2 = "Forest2"
  177.     #    t.disable_dash = true
  178.     #    t.walk_speed = -1
  179.     #    t.airship_land_ok = false
  180.     #
  181.     #  Whenever the player was walking on terrain tagged as 4:
  182.     #    Enemy encounters would occur one and a half times more frequently
  183.     #    Enemies are twice as likely to get a surprise attack
  184.     #    The battlefield will be "DirtField" & "Forest2"
  185.     #    The player would be unable to dash
  186.     #    The player's movement speed would be reduced by 1
  187.     #    Airships cannot land on this terrain.
  188.     #````````````````````````````````````````````````````````````````````````
  189.     #    EXAMPLE 2:
  190.     #
  191.     #  when 7 # Terrain Tag: 7
  192.     #    t.encounter_rate = 0
  193.     #    t.walk_se = se.new("Knock", 60)
  194.     #    t.se_random_pitch = 80..120
  195.     #
  196.     #  Whenever the player was walking on terrain tagged as 7:
  197.     #    There would not be any enemy encounters
  198.     #    Each step, the "Knock" SE plays at 60 volume and a pitch between 80-120
  199.     #````````````````````````````````````````````````````````````````````````
  200.     #  If you need more than terrain tags 0-7, just add a new when line for
  201.     # each new ID and configure it as you do the rest.
  202.     #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  203.     when 0 # Terrain Tag: 0 - Regular
  204.     when 1 # Terrain Tag: 1 -
  205.     when 2 # Terrain Tag: 2 -
  206.     when 3 # Terrain Tag: 3 -
  207.     when 4 # Terrain Tag: 4 -
  208.     when 5 # Terrain Tag: 5 -
  209.     when 6 # Terrain Tag: 6 -
  210.     when 7 # Terrain Tag: 7 -
  211.     #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  212.     #  END Editable Region
  213.     #////////////////////////////////////////////////////////////////////////
  214.     end
  215.     t
  216.   end
  217.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  218.   # * Set Default values for features
  219.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  220.   def self.default_value_for(feature)
  221.     # Default Values
  222.     case feature
  223.     when :encounter_rate then 100
  224.     when :preemptive_rate then 100
  225.     when :surprise_rate then 100
  226.     when :disable_dash then false
  227.     when :walk_speed then 0
  228.     when :boat_speed then 0
  229.     when :ship_speed then 0
  230.     when :airship_speed then 0
  231.     when :common_event_id then 0
  232.     else nil # Everything else
  233.     end
  234.   end
  235.  
  236.   #============================================================================
  237.   # *** Array_DataTerrains
  238.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  239.   #  This mixes in to the $data_ma_terrains array
  240.   #============================================================================
  241.  
  242.   module Array_DataTerrains
  243.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  244.     # * Get Terrain (lazy instantiation)
  245.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  246.     def [](terrain_id)
  247.       result = super(terrain_id)
  248.       if !result
  249.         result = MA_TerrainFeatures.terrain_data(terrain_id)
  250.         self[terrain_id] = result
  251.       end
  252.       result
  253.     end
  254.   end
  255. end
  256.  
  257. #==============================================================================
  258. # *** DataManager
  259. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  260. #  Summary of Changes:
  261. #    aliased method - self.load_database
  262. #==============================================================================
  263.  
  264. class << DataManager
  265.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  266.   # * Load Normal/Battle Test Database
  267.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  268.   [:load_normal_database, :load_battle_test_database].each { |method|
  269.     alias_method(:"matf_#{method}_9xa4", method)
  270.     define_method(method) do |*args|
  271.       send(:"matf_#{method}_9xa4", *args)
  272.       $data_ma_terrains = [].extend(MA_TerrainFeatures::Array_DataTerrains)
  273.     end
  274.   }
  275. end
  276.  
  277. #==============================================================================
  278. # ** Game_Map
  279. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  280. #  Summary of Changes:
  281. #    aliased methods - setup; terrain_tag; disable_dash?; boat_passable?;
  282. #      ship_passable?; airship_land_ok?
  283. #    new method - matf_create_substitute_terrains; matf_airship_passable?
  284. #==============================================================================
  285.  
  286. class Game_Map
  287.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  288.   # * Setup
  289.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  290.   alias matf_setp_4oz6 setup
  291.   def setup(*args)
  292.     matf_setp_4oz6(*args) # Call original method
  293.     matf_create_substitute_terrains
  294.   end
  295.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  296.   # * Create Substitute Terrains
  297.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  298.   def matf_create_substitute_terrains
  299.     @matf_sub_terrains = [0, 1, 2, 3, 4, 5, 6, 7]
  300.     subs = tileset.note.scan(/\\SUB_TERRAINS?\[(.*?)\]/im).flatten.join(';')
  301.     subs.scan(/(\d+)[\s=>,]+(\d+)/).each { |a,b| @matf_sub_terrains[a.to_i] = b.to_i }
  302.   end
  303.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  304.   # * Terrain Tag
  305.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  306.   alias matf_terrtag_5io7 terrain_tag
  307.   def terrain_tag(*args)
  308.     @matf_sub_terrains[matf_terrtag_5io7(*args)] # Call original method
  309.   end
  310.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  311.   # * Check if Dashing
  312.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  313.   alias matf_disabldsh_8hb5 disable_dash?
  314.   def disable_dash?(*args)
  315.     matf_disabldsh_8hb5(*args) || $data_ma_terrains[$game_player.terrain_tag].disable_dash
  316.   end
  317.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  318.   # * Determine if Passable by Boat/Ship or Airship Can Land
  319.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  320.   [:boat_passable, :ship_passable, :airship_land_ok].each { |method|
  321.     alias_method(:"matf_check#{method}_3um9", :"#{method}?")
  322.     define_method(:"#{method}?") do |x, y, *args|
  323.       pass = $data_ma_terrains[terrain_tag(x, y)][method]
  324.       pass == !!pass ? pass : send(:"matf_check#{method}_3um9", x, y, *args)
  325.     end
  326.   }
  327. end
  328.  
  329. #==============================================================================
  330. # ** Game_CharacterBase
  331. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  332. #  Summary of Changes:
  333. #    aliased method - real_move_speed
  334. #    new method - terrain_speed_modifier
  335. #==============================================================================
  336.  
  337. class Game_CharacterBase
  338.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  339.   # * Get Move Speed
  340.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  341.   alias matf_realmvspeed_4wm3 real_move_speed
  342.   def real_move_speed(*args)
  343.     spd = matf_realmvspeed_4wm3(*args) + terrain_speed_modifier
  344.     spd > 0 ? spd : 1
  345.   end
  346.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  347.   # * Terrain Speed Modifier
  348.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  349.   def terrain_speed_modifier
  350.     $data_ma_terrains[terrain_tag].walk_speed
  351.   end
  352. end
  353.  
  354. if $imported[:MA_BoatShipPassability] # Compatibility with Boat/Ship Passability
  355.   #============================================================================
  356.   # ** Game_Event
  357.   #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  358.   #  Summary of Changes:
  359.   #    overwritten supermethod - terrain_speed_modifier
  360.   #============================================================================
  361.  
  362.   class Game_Event
  363.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  364.     # * Terrain Speed Modifier
  365.     #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  366.     def terrain_speed_modifier
  367.       case @mabspe_passability
  368.       when :boat then $data_ma_terrains[terrain_tag].boat_speed       # Boat
  369.       when :ship then $data_ma_terrains[terrain_tag].ship_speed       # Ship
  370.       else super                                                      # Walk
  371.       end
  372.     end
  373.   end
  374. end
  375.  
  376. #==============================================================================
  377. # ** Game_Player
  378. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  379. #  Summary of Changes:
  380. #    aliased method - encounter_progress_value; increase_steps
  381. #    overwritten supermethod - terrain_speed_modifier
  382. #==============================================================================
  383.  
  384. class Game_Player
  385.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  386.   # * Get Encounter Progress Value
  387.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  388.   alias matf_encountprgrssval_5rz3 encounter_progress_value
  389.   def encounter_progress_value(*args)
  390.     value = matf_encountprgrssval_5rz3(*args) # Call Original Method
  391.     value * ($data_ma_terrains[$game_player.terrain_tag].encounter_rate / 100.0)
  392.   end
  393.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  394.   # * Increase Steps
  395.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  396.   alias matf_incstps_1ok6 increase_steps
  397.   def increase_steps(*args)
  398.     matf_incstps_1ok6(*args) # Call Original Method
  399.     terrain = $data_ma_terrains[terrain_tag]
  400.     $game_temp.reserve_common_event(terrain.common_event_id) if terrain.common_event_id > 0
  401.     matf_play_move_se
  402.   end
  403.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  404.   # * Play Move SE
  405.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  406.   def matf_play_move_se
  407.     terrain = $data_ma_terrains[terrain_tag]
  408.     # Select SE depending on vehicle
  409.     se = case @vehicle_type
  410.     when :boat, :ship, :airship, :walk then terrain[:"#{@vehicle_type}_se"]
  411.     else nil # Don't do it as above just in case new vehicle types
  412.     end
  413.     # Play SE if it exists
  414.     if se
  415.       rand_p = terrain.se_random_pitch
  416.       se.pitch = (rand_p.first + rand(rand_p.last - rand_p.first)) if rand_p
  417.       se.play
  418.     end
  419.   end
  420.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  421.   # * Terrain Speed Modifier
  422.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  423.   def terrain_speed_modifier
  424.     case @vehicle_type
  425.     when :boat then $data_ma_terrains[terrain_tag].boat_speed       # Boat
  426.     when :ship then $data_ma_terrains[terrain_tag].ship_speed       # Ship
  427.     when :airship then $data_ma_terrains[terrain_tag].airship_speed # Airship
  428.     else super                                                      # Walk
  429.     end
  430.   end
  431. end
  432.  
  433. #==============================================================================
  434. # ** Game_Party
  435. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  436. #  Summary of Changes:
  437. #    aliased methods - rate_preemptive; rate_surprise
  438. #==============================================================================
  439.  
  440. class Game_Party
  441.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  442.   # * Calculate Probability of Preemptive Attack
  443.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  444.   alias matf_ratepreempt_3jn6 rate_preemptive
  445.   def rate_preemptive(*args)
  446.     terrain_per = $data_ma_terrains[$game_player.terrain_tag].preemptive_rate
  447.     matf_ratepreempt_3jn6(*args) * (terrain_per / 100.0)
  448.   end
  449.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  450.   # * Calculate Probability of Surprise
  451.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  452.   alias matf_ratsurprise_5kv2 rate_surprise
  453.   def rate_surprise(*args)
  454.     terrain_per = $data_ma_terrains[$game_player.terrain_tag].surprise_rate
  455.     matf_ratsurprise_5kv2(*args) * (terrain_per / 100.0)
  456.   end
  457. end
  458.  
  459. #==============================================================================
  460. # ** Spriteset_Battle
  461. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  462. #  Summary of Changes:
  463. #    aliased methods - battleback1_name; battleback2_name
  464. #==============================================================================
  465.  
  466. class Spriteset_Battle
  467.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  468.   # * Get Filename of Battle Background (Floor)
  469.   #    Whether on overworld or not, check if terrain has an overriding
  470.   #    battleback and use if it does. Ignore during Battle Test
  471.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  472.   alias matf_bb1nm_2ob6 battleback1_name
  473.   def battleback1_name(*args)
  474.     bb1 = $BTEST ? nil : $data_ma_terrains[$game_player.terrain_tag].battleback_1
  475.     bb1 ? bb1 : matf_bb1nm_2ob6(*args) # Call Original Method
  476.   end
  477.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  478.   # * Get Filename of Battle Background (Wall)
  479.   #    Whether on overworld or not, check if terrain has an overriding
  480.   #    battleback and use if it does. Ignore during Battle Test
  481.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  482.   alias matf_bback2name_5vx4 battleback2_name
  483.   def battleback2_name(*args)
  484.     bb2 = $BTEST ? nil : $data_ma_terrains[$game_player.terrain_tag].battleback_2
  485.     bb2 ? bb2 : matf_bback2name_5vx4(*args) # Call Original Method
  486.   end
  487. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement