gerkrt

RPGXP - ENG - Difficulty effects

Sep 14th, 2011
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 41.40 KB | None | 0 0
  1. #==============================================================================
  2. # Difficulty effects
  3. # By gerkrt/gerrtunk, Dargor(used his difficulty script for scene title
  4. # modification)
  5. # Version: 2
  6. # License: GPL, credits
  7. #==============================================================================
  8.  
  9. =begin
  10.  
  11. This script gives a complete control of the game challengue, not only with a
  12. initial decision. Now it also let you create a menu in scene title to
  13. select the difficulty to use.
  14.  
  15. Features:
  16.  
  17. -You can create all the difficulty effects you want and active and desactive
  18. at your will. Each effect can changue some nemy atributes based in %.
  19. The effects are accumulative and saved when quit the game.
  20.  
  21. 4 ways of choosing what enemies are using the effects:
  22.  
  23. -By enemies ids
  24. -By maps ids
  25. -Using the map tree system. You only have to write the name of the parent map
  26. and all the others are included in rhe effect.
  27. -Global
  28.  
  29. -All the atributes are optional.
  30.  
  31. -You can use the value in a event variable to control all the values of a effect
  32. in real time.
  33.  
  34. -HP, SP, ATK, PDEF, PMAG, EVS, STR, DEX, AGI, INT, EXPERIENCIE, GOLD and DROP
  35.  
  36. -You can optionally create a menu in the scene title with each number of difficulty
  37. options, names,  descriptions, switch and difficulty effects that they active.
  38.  
  39. -Vocabulary control
  40.  
  41. ############ Values and sintaxis #########
  42.  
  43. Enemies atributes are calculated in %. Each atribute you add to a effect to
  44. modify starts wuth a value of 100% and then you can sum or rest to it.
  45.  
  46. Example:
  47.       Difficulty_effects[5] = {  
  48.     :active  => false,            
  49.     :type  => 3,                  
  50.     :base_map_name  => 'Forest',  
  51.     :hp => 50,                    
  52.     :sp =>-30            
  53.     }
  54.  
  55. This makes that the hp is 150 and sp 70.
  56.  
  57. :x => value of x,
  58.  
  59. You must respect :  before x name, the => separating them and the final ,
  60.  
  61. -Each new effect must have a new and unique number ID in Difficulty_effects[ID]
  62. -Dont touch the {}. They mean start and end and have to be in that positions.
  63. -You can add or remove any values, just use the same sintaxis.
  64. -The last value dont use the  final ,
  65.  
  66.  
  67. ############ Option types #########
  68.  
  69.  
  70. Obligatory:
  71.  
  72. active: If you give this a true value the script will start actived.
  73.  
  74. type: Define how is going to know the script wich enemies affect.
  75. Values:
  76.   1.By enemies ids
  77.   2.By maps ids
  78.   3.By map tree
  79.   4.Global
  80.  
  81. enemies_ids: Obligatory when type is 1. Define wich enemies are affected.
  82.   :enemies_ids => [1,2,3]
  83.  
  84. maps_ids: Obligatory when type is 2. Define wich maps are affected.
  85.   :maps_ids => [1,2,3]
  86.  
  87. base_map_name: Obligatory when type is 3. Define the parent map name.
  88.  
  89. Optionals:
  90.  
  91. variable: Makes that all values of the effect depend of that event variable value.
  92. value*event_variable/100
  93.  
  94. hp  
  95. sp  
  96.  
  97. atk  
  98. pdef  
  99. mdef
  100. evs  
  101.  
  102. str   STRENGTH
  103. dex   DEXTERITY
  104. agi   AGILITY
  105. int   INTELIGENCE
  106.  
  107. exp   EXPERIENCIE
  108. gold  MONEY
  109. drop  % OF ITEMS
  110.  
  111. Note that you can erase the example effects.
  112.  
  113. ############ Select wich enemies will use the effect #########
  114.  
  115.  
  116. -Global. All combats
  117.  
  118. -By enemies: Only the enemies that you add to the list.
  119.  
  120. -By maps: All combats in the maps that you add to the list.
  121.  
  122. -By map tree: With this you only have to define a parent map and write its name in
  123. the effect. All the maps and combats under it will have the effect.
  124.  
  125. The map tree is show under the tileset tool. If you doubleclick to - or + you will
  126. see that the maps are shown in groups that depend in parent maps.
  127.  
  128. Note: I recomend having the maps having the maps ordered and directly relationed with
  129. its parent map to have optimal performance.
  130.  
  131. Use example:
  132.  
  133. Mapamundi
  134.   Forest
  135.     Mapa3
  136.     Mapa4
  137.     Mapa5
  138.       Mapa6
  139.       Mapa7
  140.      
  141.   Pantano del Wep
  142.     Mapa9
  143.    
  144. Ex:
  145.    
  146.       Difficulty_effects[2] = {
  147.     :active  => false,
  148.     :hp => 50,
  149.     :sp => 30,
  150.     :atk   => 20,
  151.     :spi   => 20,
  152.     :agi   => 10,
  153.     :drop  => -20,
  154.     :variable  => 6,
  155.     :type  => 3,
  156.     :base_map_name  => 'Forest'
  157.   }
  158.  
  159.  
  160. Maps 3,4,5,6,7, and Forest have that effect.
  161.  
  162.  
  163. ############ Activating effects #########
  164.  
  165. Activate: start_difficulty_effect(effect number)
  166.  
  167. Desactivate: stop_difficulty_effect(effect number)
  168.  
  169. Ex: start_difficulty_effect(1)
  170.  
  171. ########### Difficulties menu ##########
  172.  
  173. I have comented in the module itself what is what. Anyway, the main thing
  174. is to define what number of difficluties, etc, want to use, and then, create
  175. a entry in the same order and position for each one, so:
  176.  
  177.   # For each difficulty, his command name
  178.   Names = [
  179.             'Loser',   # 1
  180.             'Medium',  # 2
  181.             'Hard', # 3
  182.             'Game Master' # 4
  183.           ]
  184.          
  185.   # For each difficulty, his description
  186.   Descriptions = [
  187.                   'Only a loser take this mode.', # 1
  188.                   'Medium difficulty, standard way', # 2
  189.                   'You rules!', # 3
  190.                   'Killing a slime in this mode is a miracle'   # 4
  191.                 ]
  192.  
  193. Each time the first named loser have the 1  name, the 1 description, etc
  194.  
  195. ############ Last notes #########
  196.  
  197. -All the effects to an enemy are sumed and then applied.
  198.  
  199. -You can create large number groups with this:
  200.  
  201.   :enemies_ids => (1..25).to_a
  202.  
  203.   This is like putting the enemies ids 1-25
  204.  
  205. -Creditss: this script have been created studying  KGC
  206. BattleDifficuly
  207.  
  208.  
  209. =end
  210.  
  211.  
  212. module Wep
  213.   # Dont touch this
  214.   Difficulty_effects = []
  215.  
  216.  
  217.   Difficulty_effects[1] = {
  218.     :active  => false,
  219.     :hp => 50,
  220.     :mp => 30,
  221.     :atk   => 20,
  222.     :agi   => 10,
  223.     :drop  => 20,
  224.     :variable  => 4,
  225.     :type  => 1,
  226.     :enemies_ids  => [2,3]
  227.   }
  228.     Difficulty_effects[2] = {
  229.     :active  => false,
  230.     :hp => 50,
  231.     :mp =>30,
  232.     :atk   => 20,
  233.     :agi   => 10,
  234.     :drop  => 20,
  235.     :gold => 20,
  236.     :exp => 20,
  237.     :variable  => 5,
  238.     :type  => 2,
  239.     :maps_ids  => [1,2,3,4,6,7]
  240.   }
  241.       Difficulty_effects[3] = {
  242.     :active  => false,
  243.     :hp => 50,
  244.     :mp => 30,
  245.     :atk   => 20,
  246.     :dex   => 20,
  247.     :agi   => 10,
  248.     :drop  => -20,
  249.     :variable  => 6,
  250.     :type  => 3,
  251.     :base_map_name  => 'Forest'
  252.   }
  253.         Difficulty_effects[4] = {
  254.     :active  => false,
  255.     :hp => 50,
  256.     :mp => 30,
  257.     :atk   => 20,
  258.     :agi   => 10,
  259.     :drop  => -20,
  260.     :variable  => 6,
  261.     :type  => 4
  262.   }
  263.  
  264.   # Desactive this, = false, if you dont want to modify the scene title and only
  265.   # wanto to use the geneal difficulty effects
  266.   Diff_modify_scene_title = true
  267. end
  268.  
  269.  
  270.  
  271. # The configuration of the title modification.
  272. module Difficulty
  273.   # Default difficulty used in the list
  274.   Default = 1 # medium
  275.  
  276.   # For each difficulty, his command name
  277.   Names = [
  278.             'Loser',
  279.             'Medium',
  280.             'Hard',
  281.             'Game Master'
  282.           ]
  283.          
  284.   # For each difficulty, his description
  285.   Descriptions = [
  286.                   'Only a loser take this mode.',
  287.                   'Medium difficulty, standard way',
  288.                   'You rules!',
  289.                   'Killing a slime in this mode is a miracle'
  290.                 ]
  291.                
  292.   # For each difficulty, the game switch they active
  293.   Switches = [
  294.     2,
  295.     3,
  296.     4,
  297.     5
  298.    
  299.   ]
  300.  
  301.   # For each difficulty, the difficulty effect they active
  302.   Effects = [
  303.     1,
  304.     2,
  305.     3,
  306.     4
  307.    
  308.   ]
  309.  
  310.   # Vicabulary words used in default menu
  311.   Diff_new_game_word = 'New'
  312.   Diff_load_game_word = 'Load'
  313.   Diff_exit_game_word = 'Exit'
  314. end
  315.  
  316. class Game_System
  317.   attr_accessor :difficulty_effects
  318.   alias gs_wep_cc_init initialize
  319.   def initialize
  320.     @difficulty_effects = Wep::Difficulty_effects
  321.     gs_wep_cc_init
  322.   end
  323.  
  324. end
  325.  
  326. class Interpreter
  327.  
  328.   def start_difficulty_effect(num)
  329.      $game_system.difficulty_effects[num][:active] = true
  330.   end
  331.  
  332.   def stop_difficulty_effect(num)
  333.      $game_system.difficulty_effects[num][:active] = false
  334.   end
  335.  
  336. end  
  337.  
  338. class Game_Party
  339.   def tree_includes_map? (name)
  340.     # Load mapinfos for map name
  341.     mapinfos = load_data("Data/MapInfos.rxdata")    
  342.     # If his name is the name searched
  343.     if mapinfos[$game_map.map_id].name == name
  344.         return true
  345.     end
  346.  
  347.     map = $game_map.map_id
  348.    
  349.     # Iterate all parents maps
  350.     while mapinfos[map].parent_id != 0
  351.         if mapinfos[mapinfos[map].parent_id].name == name
  352.           return true
  353.         else
  354.           map = mapinfos[map].parent_id
  355.         end
  356.     end
  357.   end
  358. end
  359.  
  360. #==============================================================================
  361. # ¦ Game_Enemy
  362. #==============================================================================
  363.  
  364. class Game_Enemy < Game_Battler
  365.   #--------------------------------------------------------------------------
  366.   # ? MaxHP
  367.   #--------------------------------------------------------------------------
  368.   alias base_maxhp_Challengue_Compensator base_maxhp
  369.   def base_maxhp
  370.     # Gets normal atribute
  371.     n = base_maxhp_Challengue_Compensator
  372.     # Sets total to a base 100%
  373.     total = 100
  374.     # Search in all effects
  375.     for effect in $game_system.difficulty_effects
  376.          # Effect type 1
  377.          if effect[:active] and effect[:type] == 1  and effect[:hp] != nil and  effect[:enemies_ids].include?(@enemy_id)
  378.            if effect[:variable] != nil
  379.              total+=effect[:hp]*$game_variables[effect[:variable]]/100
  380.            else
  381.              total+=effect[:hp]
  382.            end
  383.          end
  384.          # Effect type 2
  385.          if effect[:active] and effect[:type] == 2  and effect[:hp] != nil and  effect[:maps_ids].include?($game_map.map_id)
  386.            if effect[:variable] != nil
  387.              total+=effect[:hp]*$game_variables[effect[:variable]]/100
  388.            else
  389.              total+=effect[:hp]
  390.            end
  391.          end
  392.          # Effect type 3
  393.          if effect[:active] and effect[:type] == 3  and effect[:hp] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  394.            if effect[:variable] != nil            
  395.              total+=effect[:hp]*$game_variables[effect[:variable]].to_f/100
  396.            else
  397.              total+=effect[:hp]
  398.            end
  399.          end
  400.          # Effect type 4
  401.          if effect[:active] and effect[:type] == 4 and effect[:hp] != nil
  402.            if effect[:variable] != nil
  403.              total+=effect[:hp]*$game_variables[effect[:variable]]/100
  404.            else
  405.              total+=effect[:hp]
  406.            end
  407.          end
  408.     end
  409.     n = n * total / 100  
  410.     return n.to_i
  411.   end
  412.  
  413.   #--------------------------------------------------------------------------
  414.   # ? MaxSP
  415.   #--------------------------------------------------------------------------
  416.   alias base_maxsp_Challengue_Compensator base_maxsp
  417.   def base_maxsp
  418.     # Gets normal atribute
  419.     n = base_maxsp_Challengue_Compensator
  420.     # Sets total to a base 100%
  421.     total = 100
  422.     # Search in all effects
  423.     for effect in $game_system.difficulty_effects
  424.          # Effect type 1
  425.          if effect[:active] and effect[:type] == 1  and effect[:sp] != nil and  effect[:enemies_ids].include?(@enemy_id)
  426.            if effect[:variable] != nil
  427.              total+=effect[:sp]*$game_variables[effect[:variable]]/100
  428.            else
  429.              total+=effect[:sp]
  430.            end
  431.          end
  432.          # Effect type 2
  433.          if effect[:active] and effect[:type] == 2  and effect[:sp] != nil and  effect[:maps_ids].include?($game_map.map_id)
  434.            if effect[:variable] != nil
  435.              total+=effect[:sp]*$game_variables[effect[:variable]]/100
  436.            else
  437.              total+=effect[:sp]
  438.            end
  439.          end
  440.          # Effect type 3
  441.          if effect[:active] and effect[:type] == 3  and effect[:sp] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  442.            if effect[:variable] != nil            
  443.              total+=effect[:sp]*$game_variables[effect[:variable]].to_f/100
  444.            else
  445.              total+=effect[:sp]
  446.            end
  447.          end
  448.          # Effect type 4
  449.          if effect[:active] and effect[:type] == 4 and effect[:sp] != nil
  450.            if effect[:variable] != nil
  451.              total+=effect[:sp]*$game_variables[effect[:variable]]/100
  452.            else
  453.              total+=effect[:sp]
  454.            end
  455.          end
  456.     end
  457.     n = n * total / 100  
  458.     return n.to_i
  459.   end
  460.  
  461.   #--------------------------------------------------------------------------
  462.   # ? Maxstr
  463.   #--------------------------------------------------------------------------
  464.   alias base_str_Challengue_Compensator base_str
  465.   def base_str
  466.     # Gets normal atribute
  467.     n = base_str_Challengue_Compensator
  468.     # Sets total to a base 100%
  469.     total = 100
  470.     # Search in all effects
  471.     for effect in $game_system.difficulty_effects
  472.          # Effect type 1
  473.          if effect[:active] and effect[:type] == 1  and effect[:str] != nil and  effect[:enemies_ids].include?(@enemy_id)
  474.            if effect[:variable] != nil
  475.              total+=effect[:str]*$game_variables[effect[:variable]]/100
  476.            else
  477.              total+=effect[:str]
  478.            end
  479.          end
  480.          # Effect type 2
  481.          if effect[:active] and effect[:type] == 2  and effect[:str] != nil and  effect[:maps_ids].include?($game_map.map_id)
  482.            if effect[:variable] != nil
  483.              total+=effect[:str]*$game_variables[effect[:variable]]/100
  484.            else
  485.              total+=effect[:str]
  486.            end
  487.          end
  488.          # Effect type 3
  489.          if effect[:active] and effect[:type] == 3  and effect[:str] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  490.            if effect[:variable] != nil            
  491.              total+=effect[:str]*$game_variables[effect[:variable]].to_f/100
  492.            else
  493.              total+=effect[:str]
  494.            end
  495.          end
  496.          # Effect type 4
  497.          if effect[:active] and effect[:type] == 4 and effect[:str] != nil
  498.            if effect[:variable] != nil
  499.              total+=effect[:str]*$game_variables[effect[:variable]]/100
  500.            else
  501.              total+=effect[:str]
  502.            end
  503.          end
  504.     end
  505.     n = n * total / 100  
  506.     return n.to_i
  507.   end
  508.  
  509.   #--------------------------------------------------------------------------
  510.   # ? Maxdex
  511.   #--------------------------------------------------------------------------
  512.   alias base_dex_Challengue_Compensator base_dex
  513.   def base_dex
  514.     # Gets normal atribute
  515.     n = base_dex_Challengue_Compensator
  516.     # Sets total to a base 100%
  517.     total = 100
  518.     # Search in all effects
  519.     for effect in $game_system.difficulty_effects
  520.          # Effect type 1
  521.          if effect[:active] and effect[:type] == 1  and effect[:dex] != nil and  effect[:enemies_ids].include?(@enemy_id)
  522.            if effect[:variable] != nil
  523.              total+=effect[:dex]*$game_variables[effect[:variable]]/100
  524.            else
  525.              total+=effect[:dex]
  526.            end
  527.          end
  528.          # Effect type 2
  529.          if effect[:active] and effect[:type] == 2  and effect[:dex] != nil and  effect[:maps_ids].include?($game_map.map_id)
  530.            if effect[:variable] != nil
  531.              total+=effect[:dex]*$game_variables[effect[:variable]]/100
  532.            else
  533.              total+=effect[:dex]
  534.            end
  535.          end
  536.          # Effect type 3
  537.          if effect[:active] and effect[:type] == 3  and effect[:dex] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  538.            if effect[:variable] != nil            
  539.              total+=effect[:dex]*$game_variables[effect[:variable]].to_f/100
  540.            else
  541.              total+=effect[:dex]
  542.            end
  543.          end
  544.          # Effect type 4
  545.          if effect[:active] and effect[:type] == 4 and effect[:dex] != nil
  546.            if effect[:variable] != nil
  547.              total+=effect[:dex]*$game_variables[effect[:variable]]/100
  548.            else
  549.              total+=effect[:dex]
  550.            end
  551.          end
  552.     end
  553.     n = n * total / 100  
  554.     return n.to_i
  555.   end
  556.  
  557.   #--------------------------------------------------------------------------
  558.   # ? Maxagi
  559.   #--------------------------------------------------------------------------
  560.   alias base_agi_Challengue_Compensator base_agi
  561.   def base_agi
  562.     # Gets normal atribute
  563.     n = base_agi_Challengue_Compensator
  564.     # Sets total to a base 100%
  565.     total = 100
  566.     # Search in all effects
  567.     for effect in $game_system.difficulty_effects
  568.          # Effect type 1
  569.          if effect[:active] and effect[:type] == 1  and effect[:agi] != nil and  effect[:enemies_ids].include?(@enemy_id)
  570.            if effect[:variable] != nil
  571.              total+=effect[:agi]*$game_variables[effect[:variable]]/100
  572.            else
  573.              total+=effect[:agi]
  574.            end
  575.          end
  576.          # Effect type 2
  577.          if effect[:active] and effect[:type] == 2  and effect[:agi] != nil and  effect[:maps_ids].include?($game_map.map_id)
  578.            if effect[:variable] != nil
  579.              total+=effect[:agi]*$game_variables[effect[:variable]]/100
  580.            else
  581.              total+=effect[:agi]
  582.            end
  583.          end
  584.          # Effect type 3
  585.          if effect[:active] and effect[:type] == 3  and effect[:agi] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  586.            if effect[:variable] != nil            
  587.              total+=effect[:agi]*$game_variables[effect[:variable]].to_f/100
  588.            else
  589.              total+=effect[:agi]
  590.            end
  591.          end
  592.          # Effect type 4
  593.          if effect[:active] and effect[:type] == 4 and effect[:agi] != nil
  594.            if effect[:variable] != nil
  595.              total+=effect[:agi]*$game_variables[effect[:variable]]/100
  596.            else
  597.              total+=effect[:agi]
  598.            end
  599.          end
  600.     end
  601.     n = n * total / 100  
  602.     return n.to_i
  603.   end
  604.  
  605.   #--------------------------------------------------------------------------
  606.   # ? Maxint
  607.   #--------------------------------------------------------------------------
  608.   alias base_int_Challengue_Compensator base_int
  609.   def base_int
  610.     # Gets normal atribute
  611.     n = base_int_Challengue_Compensator
  612.     # Sets total to a base 100%
  613.     total = 100
  614.     # Search in all effects
  615.     for effect in $game_system.difficulty_effects
  616.          # Effect type 1
  617.          if effect[:active] and effect[:type] == 1  and effect[:int] != nil and  effect[:enemies_ids].include?(@enemy_id)
  618.            if effect[:variable] != nil
  619.              total+=effect[:int]*$game_variables[effect[:variable]]/100
  620.            else
  621.              total+=effect[:int]
  622.            end
  623.          end
  624.          # Effect type 2
  625.          if effect[:active] and effect[:type] == 2  and effect[:int] != nil and  effect[:maps_ids].include?($game_map.map_id)
  626.            if effect[:variable] != nil
  627.              total+=effect[:int]*$game_variables[effect[:variable]]/100
  628.            else
  629.              total+=effect[:int]
  630.            end
  631.          end
  632.          # Effect type 3
  633.          if effect[:active] and effect[:type] == 3  and effect[:int] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  634.            if effect[:variable] != nil            
  635.              total+=effect[:int]*$game_variables[effect[:variable]].to_f/100
  636.            else
  637.              total+=effect[:int]
  638.            end
  639.          end
  640.          # Effect type 4
  641.          if effect[:active] and effect[:type] == 4 and effect[:int] != nil
  642.            if effect[:variable] != nil
  643.              total+=effect[:int]*$game_variables[effect[:variable]]/100
  644.            else
  645.              total+=effect[:int]
  646.            end
  647.          end
  648.     end
  649.     n = n * total / 100  
  650.     return n.to_i
  651.   end
  652.  
  653.   #--------------------------------------------------------------------------
  654.   # ? Maxatk
  655.   #--------------------------------------------------------------------------
  656.   alias base_atk_Challengue_Compensator base_atk
  657.   def base_atk
  658.     # Gets normal atribute
  659.     n = base_atk_Challengue_Compensator
  660.     # Sets total to a base 100%
  661.     total = 100
  662.     # Search in all effects
  663.     for effect in $game_system.difficulty_effects
  664.          # Effect type 1
  665.          if effect[:active] and effect[:type] == 1  and effect[:atk] != nil and  effect[:enemies_ids].include?(@enemy_id)
  666.            if effect[:variable] != nil
  667.              total+=effect[:atk]*$game_variables[effect[:variable]]/100
  668.            else
  669.              total+=effect[:atk]
  670.            end
  671.          end
  672.          # Effect type 2
  673.          if effect[:active] and effect[:type] == 2  and effect[:atk] != nil and  effect[:maps_ids].include?($game_map.map_id)
  674.            if effect[:variable] != nil
  675.              total+=effect[:atk]*$game_variables[effect[:variable]]/100
  676.            else
  677.              total+=effect[:atk]
  678.            end
  679.          end
  680.          # Effect type 3
  681.          if effect[:active] and effect[:type] == 3  and effect[:atk] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  682.            if effect[:variable] != nil            
  683.              total+=effect[:atk]*$game_variables[effect[:variable]].to_f/100
  684.            else
  685.              total+=effect[:atk]
  686.            end
  687.          end
  688.          # Effect type 4
  689.          if effect[:active] and effect[:type] == 4 and effect[:atk] != nil
  690.            if effect[:variable] != nil
  691.              total+=effect[:atk]*$game_variables[effect[:variable]]/100
  692.            else
  693.              total+=effect[:atk]
  694.            end
  695.          end
  696.     end
  697.     n = n * total / 100  
  698.     return n.to_i
  699.   end
  700.  
  701.   #--------------------------------------------------------------------------
  702.   # ? Maxpdef
  703.   #--------------------------------------------------------------------------
  704.   alias base_pdef_Challengue_Compensator base_pdef
  705.   def base_pdef
  706.     # Gets normal atribute
  707.     n = base_pdef_Challengue_Compensator
  708.     # Sets total to a base 100%
  709.     total = 100
  710.     # Search in all effects
  711.     for effect in $game_system.difficulty_effects
  712.          # Effect type 1
  713.          if effect[:active] and effect[:type] == 1  and effect[:pdef] != nil and  effect[:enemies_ids].include?(@enemy_id)
  714.            if effect[:variable] != nil
  715.              total+=effect[:pdef]*$game_variables[effect[:variable]]/100
  716.            else
  717.              total+=effect[:pdef]
  718.            end
  719.          end
  720.          # Effect type 2
  721.          if effect[:active] and effect[:type] == 2  and effect[:pdef] != nil and  effect[:maps_ids].include?($game_map.map_id)
  722.            if effect[:variable] != nil
  723.              total+=effect[:pdef]*$game_variables[effect[:variable]]/100
  724.            else
  725.              total+=effect[:pdef]
  726.            end
  727.          end
  728.          # Effect type 3
  729.          if effect[:active] and effect[:type] == 3  and effect[:pdef] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  730.            if effect[:variable] != nil            
  731.              total+=effect[:pdef]*$game_variables[effect[:variable]].to_f/100
  732.            else
  733.              total+=effect[:pdef]
  734.            end
  735.          end
  736.          # Effect type 4
  737.          if effect[:active] and effect[:type] == 4 and effect[:pdef] != nil
  738.            if effect[:variable] != nil
  739.              total+=effect[:pdef]*$game_variables[effect[:variable]]/100
  740.            else
  741.              total+=effect[:pdef]
  742.            end
  743.          end
  744.     end
  745.     n = n * total / 100  
  746.     return n.to_i
  747.   end
  748.  
  749.   #--------------------------------------------------------------------------
  750.   # ? Maxmdef
  751.   #--------------------------------------------------------------------------
  752.   alias base_mdef_Challengue_Compensator base_mdef
  753.   def base_mdef
  754.     # Gets normal atribute
  755.     n = base_mdef_Challengue_Compensator
  756.     # Sets total to a base 100%
  757.     total = 100
  758.     # Search in all effects
  759.     for effect in $game_system.difficulty_effects
  760.          # Effect type 1
  761.          if effect[:active] and effect[:type] == 1  and effect[:mdef] != nil and  effect[:enemies_ids].include?(@enemy_id)
  762.            if effect[:variable] != nil
  763.              total+=effect[:mdef]*$game_variables[effect[:variable]]/100
  764.            else
  765.              total+=effect[:mdef]
  766.            end
  767.          end
  768.          # Effect type 2
  769.          if effect[:active] and effect[:type] == 2  and effect[:mdef] != nil and  effect[:maps_ids].include?($game_map.map_id)
  770.            if effect[:variable] != nil
  771.              total+=effect[:mdef]*$game_variables[effect[:variable]]/100
  772.            else
  773.              total+=effect[:mdef]
  774.            end
  775.          end
  776.          # Effect type 3
  777.          if effect[:active] and effect[:type] == 3  and effect[:mdef] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  778.            if effect[:variable] != nil            
  779.              total+=effect[:mdef]*$game_variables[effect[:variable]].to_f/100
  780.            else
  781.              total+=effect[:mdef]
  782.            end
  783.          end
  784.          # Effect type 4
  785.          if effect[:active] and effect[:type] == 4 and effect[:mdef] != nil
  786.            if effect[:variable] != nil
  787.              total+=effect[:mdef]*$game_variables[effect[:variable]]/100
  788.            else
  789.              total+=effect[:mdef]
  790.            end
  791.          end
  792.     end
  793.     n = n * total / 100  
  794.     return n.to_i
  795.   end
  796.  
  797.   #--------------------------------------------------------------------------
  798.   # ? Maxeva
  799.   #--------------------------------------------------------------------------
  800.   alias base_eva_Challengue_Compensator base_eva
  801.   def base_eva
  802.     # Gets normal atribute
  803.     n = base_eva_Challengue_Compensator
  804.     # Sets total to a base 100%
  805.     total = 100
  806.     # Search in all effects
  807.     for effect in $game_system.difficulty_effects
  808.          # Effect type 1
  809.          if effect[:active] and effect[:type] == 1  and effect[:eva] != nil and  effect[:enemies_ids].include?(@enemy_id)
  810.            if effect[:variable] != nil
  811.              total+=effect[:eva]*$game_variables[effect[:variable]]/100
  812.            else
  813.              total+=effect[:eva]
  814.            end
  815.          end
  816.          # Effect type 2
  817.          if effect[:active] and effect[:type] == 2  and effect[:eva] != nil and  effect[:maps_ids].include?($game_map.map_id)
  818.            if effect[:variable] != nil
  819.              total+=effect[:eva]*$game_variables[effect[:variable]]/100
  820.            else
  821.              total+=effect[:eva]
  822.            end
  823.          end
  824.          # Effect type 3
  825.          if effect[:active] and effect[:type] == 3  and effect[:eva] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  826.            if effect[:variable] != nil            
  827.              total+=effect[:eva]*$game_variables[effect[:variable]].to_f/100
  828.            else
  829.              total+=effect[:eva]
  830.            end
  831.          end
  832.          # Effect type 4
  833.          if effect[:active] and effect[:type] == 4 and effect[:eva] != nil
  834.            if effect[:variable] != nil
  835.              total+=effect[:eva]*$game_variables[effect[:variable]]/100
  836.            else
  837.              total+=effect[:eva]
  838.            end
  839.          end
  840.     end
  841.     n = n * total / 100  
  842.     return n.to_i
  843.   end
  844.  
  845.   #--------------------------------------------------------------------------
  846.   # ? Maxexp
  847.   #--------------------------------------------------------------------------
  848.   alias exp_Challengue_Compensator exp
  849.   def exp
  850.     # Gets normal atribute
  851.     n = exp_Challengue_Compensator
  852.     # Sets total to a base 100%
  853.     total = 100
  854.     # Search in all effects
  855.     for effect in $game_system.difficulty_effects
  856.          # Effect type 1
  857.          if effect[:active] and effect[:type] == 1  and effect[:exp] != nil and  effect[:enemies_ids].include?(@enemy_id)
  858.            if effect[:variable] != nil
  859.              total+=effect[:exp]*$game_variables[effect[:variable]]/100
  860.            else
  861.              total+=effect[:exp]
  862.            end
  863.          end
  864.          # Effect type 2
  865.          if effect[:active] and effect[:type] == 2  and effect[:exp] != nil and  effect[:maps_ids].include?($game_map.map_id)
  866.            if effect[:variable] != nil
  867.              total+=effect[:exp]*$game_variables[effect[:variable]]/100
  868.            else
  869.              total+=effect[:exp]
  870.            end
  871.          end
  872.          # Effect type 3
  873.          if effect[:active] and effect[:type] == 3  and effect[:exp] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  874.            if effect[:variable] != nil            
  875.              total+=effect[:exp]*$game_variables[effect[:variable]].to_f/100
  876.            else
  877.              total+=effect[:exp]
  878.            end
  879.          end
  880.          # Effect type 4
  881.          if effect[:active] and effect[:type] == 4 and effect[:exp] != nil
  882.            if effect[:variable] != nil
  883.              total+=effect[:exp]*$game_variables[effect[:variable]]/100
  884.            else
  885.              total+=effect[:exp]
  886.            end
  887.          end
  888.     end
  889.     n = n * total / 100  
  890.     return n.to_i
  891.   end
  892.  
  893.   #--------------------------------------------------------------------------
  894.   # ? Maxgold
  895.   #--------------------------------------------------------------------------
  896.   alias gold_Challengue_Compensator gold
  897.   def gold
  898.     # Gets normal atribute
  899.     n = gold_Challengue_Compensator
  900.     # Sets total to a base 100%
  901.     total = 100
  902.     # Search in all effects
  903.     for effect in $game_system.difficulty_effects
  904.          # Effect type 1
  905.          if effect[:active] and effect[:type] == 1  and effect[:gold] != nil and  effect[:enemies_ids].include?(@enemy_id)
  906.            if effect[:variable] != nil
  907.              total+=effect[:gold]*$game_variables[effect[:variable]]/100
  908.            else
  909.              total+=effect[:gold]
  910.            end
  911.          end
  912.          # Effect type 2
  913.          if effect[:active] and effect[:type] == 2  and effect[:gold] != nil and  effect[:maps_ids].include?($game_map.map_id)
  914.            if effect[:variable] != nil
  915.              total+=effect[:gold]*$game_variables[effect[:variable]]/100
  916.            else
  917.              total+=effect[:gold]
  918.            end
  919.          end
  920.          # Effect type 3
  921.          if effect[:active] and effect[:type] == 3  and effect[:gold] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  922.            if effect[:variable] != nil            
  923.              total+=effect[:gold]*$game_variables[effect[:variable]].to_f/100
  924.            else
  925.              total+=effect[:gold]
  926.            end
  927.          end
  928.          # Effect type 4
  929.          if effect[:active] and effect[:type] == 4 and effect[:gold] != nil
  930.            if effect[:variable] != nil
  931.              total+=effect[:gold]*$game_variables[effect[:variable]]/100
  932.            else
  933.              total+=effect[:gold]
  934.            end
  935.          end
  936.     end
  937.     n = n * total / 100  
  938.     return n.to_i
  939.   end
  940.  
  941.   #--------------------------------------------------------------------------
  942.   # ? Maxdrop
  943.   #--------------------------------------------------------------------------
  944.   alias treasure_prob_Challengue_Compensator treasure_prob
  945.   def treasure_prob
  946.     # Gets normal atribute
  947.     n = treasure_prob_Challengue_Compensator
  948.     # Sets total to a base 100%
  949.     total = 100
  950.     # Search in all effects
  951.     for effect in $game_system.difficulty_effects
  952.          # Effect type 1
  953.          if effect[:active] and effect[:type] == 1  and effect[:drop] != nil and  effect[:enemies_ids].include?(@enemy_id)
  954.            if effect[:variable] != nil
  955.              total+=effect[:drop]*$game_variables[effect[:variable]]/100
  956.            else
  957.              total+=effect[:drop]
  958.            end
  959.          end
  960.          # Effect type 2
  961.          if effect[:active] and effect[:type] == 2  and effect[:drop] != nil and  effect[:maps_ids].include?($game_map.map_id)
  962.            if effect[:variable] != nil
  963.              total+=effect[:drop]*$game_variables[effect[:variable]]/100
  964.            else
  965.              total+=effect[:drop]
  966.            end
  967.          end
  968.          # Effect type 3
  969.          if effect[:active] and effect[:type] == 3  and effect[:drop] != nil and $game_party.tree_includes_map? (effect[:base_map_name])
  970.            if effect[:variable] != nil            
  971.              total+=effect[:drop]*$game_variables[effect[:variable]].to_f/100
  972.            else
  973.              total+=effect[:drop]
  974.            end
  975.          end
  976.          # Effect type 4
  977.          if effect[:active] and effect[:type] == 4 and effect[:drop] != nil
  978.            if effect[:variable] != nil
  979.              total+=effect[:drop]*$game_variables[effect[:variable]]/100
  980.            else
  981.              total+=effect[:drop]
  982.            end
  983.          end
  984.     end
  985.     n = n * total / 100  
  986.     return n.to_i
  987.   end
  988. end
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997. #==============================================================================
  998. # ** Difficulties
  999. #------------------------------------------------------------------------------
  1000. #  © Dargor, 2008
  1001. #  Ported to Xp and Modified by gerkrt to use difficulty effects script
  1002. #  24/06/08
  1003. #  Version 1.1
  1004. #  Pedido do van hellblaze
  1005. #  Tradução para português: Rafidelis
  1006. #  www.ReinoRpg.com
  1007. #------------------------------------------------------------------------------
  1008. #  HISTORICO DAS VERSÕES
  1009. #   - 1.0 (24/06/08), Versão inicial
  1010. #   - 1.1 (24/06/08),Adicionada EXP e Gold modificações
  1011. #------------------------------------------------------------------------------
  1012. #  INSTRUÇÕES:
  1013. #   - Cole Acima do Main
  1014. #   - Edit as constates no modulo de Dificuldade
  1015. #==============================================================================
  1016.  
  1017.  
  1018. #==============================================================================
  1019. # ** Game_System
  1020. #------------------------------------------------------------------------------
  1021. # Esta classe manipula dados relacionados com o sistema.Também gerencia veículos e BGM, etc
  1022. # A instância desta classe é referenciado por $ game_system.
  1023. #==============================================================================
  1024.  
  1025. class Game_System
  1026.   #--------------------------------------------------------------------------
  1027.   # * Variaveis de Instacia Publica
  1028.   #--------------------------------------------------------------------------
  1029.   attr_accessor :difficulty_id
  1030.   #--------------------------------------------------------------------------
  1031.   # * Alias Listing
  1032.   #--------------------------------------------------------------------------
  1033.   alias dargor_vx_difficulty_system_initialize initialize
  1034.   #--------------------------------------------------------------------------
  1035.   # * Object Initialization
  1036.   #--------------------------------------------------------------------------
  1037.   def initialize
  1038.     dargor_vx_difficulty_system_initialize
  1039.     @difficulty_id = Difficulty::Default
  1040.   end
  1041.   #--------------------------------------------------------------------------
  1042.   # * Get Difficulty
  1043.   #--------------------------------------------------------------------------
  1044.   def difficulty
  1045.     return Difficulty::Modifiers[@difficulty_id]
  1046.   end
  1047. end
  1048.  
  1049.  
  1050. if Wep::Diff_modify_scene_title
  1051.  
  1052.  
  1053. #==============================================================================
  1054. # ** Scene_Title
  1055. #------------------------------------------------------------------------------
  1056. # Esta classe realiza a tranformação da tela de título.
  1057. #==============================================================================
  1058.  
  1059. class Scene_Title
  1060.   #--------------------------------------------------------------------------
  1061.   # * Main Processing
  1062.   #--------------------------------------------------------------------------
  1063.   def main
  1064.     # If battle test
  1065.     if $BTEST
  1066.       battle_test
  1067.       return
  1068.     end
  1069.     # Load database
  1070.     $data_actors        = load_data("Data/Actors.rxdata")
  1071.     $data_classes       = load_data("Data/Classes.rxdata")
  1072.     $data_skills        = load_data("Data/Skills.rxdata")
  1073.     $data_items         = load_data("Data/Items.rxdata")
  1074.     $data_weapons       = load_data("Data/Weapons.rxdata")
  1075.     $data_armors        = load_data("Data/Armors.rxdata")
  1076.     $data_enemies       = load_data("Data/Enemies.rxdata")
  1077.     $data_troops        = load_data("Data/Troops.rxdata")
  1078.     $data_states        = load_data("Data/States.rxdata")
  1079.     $data_animations    = load_data("Data/Animations.rxdata")
  1080.     $data_tilesets      = load_data("Data/Tilesets.rxdata")
  1081.     $data_common_events = load_data("Data/CommonEvents.rxdata")
  1082.     $data_system        = load_data("Data/System.rxdata")
  1083.     # Make system object
  1084.     $game_system = Game_System.new
  1085.     # Make title graphic
  1086.     @sprite = Sprite.new
  1087.     @sprite.bitmap = RPG::Cache.title($data_system.title_name)
  1088.    
  1089.     # Make command window
  1090.     s1 = Difficulty::Diff_new_game_word
  1091.     s2 = Difficulty::Diff_load_game_word
  1092.     s3 = Difficulty::Diff_exit_game_word
  1093.     @command_window = Window_Command.new(192, [s1, s2, s3])
  1094.     @command_window.back_opacity = 160
  1095.     @command_window.x = 320 - @command_window.width / 2
  1096.     @command_window.y = 288
  1097.    
  1098.     @help_window = Window_Help.new
  1099.     @help_window.visible = false
  1100.     create_difficulty_window
  1101.    
  1102.     # Continue enabled determinant
  1103.     # Check if at least one save file exists
  1104.     # If enabled, make @continue_enabled true; if disabled, make it false
  1105.     @continue_enabled = false
  1106.     for i in 0..3
  1107.       if FileTest.exist?("Save#{i+1}.rxdata")
  1108.         @continue_enabled = true
  1109.       end
  1110.     end
  1111.     # If continue is enabled, move cursor to "Continue"
  1112.     # If disabled, display "Continue" text in gray
  1113.     if @continue_enabled
  1114.       @command_window.index = 1
  1115.     else
  1116.       @command_window.disable_item(1)
  1117.     end
  1118.     # Play title BGM
  1119.     $game_system.bgm_play($data_system.title_bgm)
  1120.     # Stop playing ME and BGS
  1121.     Audio.me_stop
  1122.     Audio.bgs_stop
  1123.     # Execute transition
  1124.     Graphics.transition
  1125.     # Main loop
  1126.     loop do
  1127.       # Update game screen
  1128.       Graphics.update
  1129.       # Update input information
  1130.       Input.update
  1131.       # Frame update
  1132.       update
  1133.       # Abort loop if screen is changed
  1134.       if $scene != self
  1135.         break
  1136.       end
  1137.     end
  1138.     # Prepare for transition
  1139.     Graphics.freeze
  1140.     # Dispose of command window
  1141.     @command_window.dispose
  1142.     # Dispose of title graphic
  1143.     @sprite.bitmap.dispose
  1144.     @sprite.dispose
  1145.   end
  1146.  
  1147.  
  1148.   #--------------------------------------------------------------------------
  1149.   # * Create difficulty window: size based in number of dificulties
  1150.   #--------------------------------------------------------------------------
  1151.   alias dargor_vx_difficulty_title_update update
  1152.   def create_difficulty_window
  1153.     names = []
  1154.     for name in Difficulty::Names
  1155.       names << name
  1156.     end
  1157.     @difficulty_window = Window_Command.new(172, names)
  1158.     @difficulty_window.x = @command_window.x
  1159.     @difficulty_window.y = @command_window.y
  1160.     @difficulty_window.height = @command_window.height
  1161.     @difficulty_window.visible = false
  1162.     @difficulty_window.active = false
  1163.  
  1164.     # Set initial dificult text
  1165.     @help_window.set_text(Difficulty::Descriptions[0])
  1166.     @help_window.visible = false
  1167.   end
  1168.  
  1169.   #--------------------------------------------------------------------------
  1170.   # * Frame Update
  1171.   #--------------------------------------------------------------------------
  1172.   def update
  1173.     # Update command window
  1174.     @command_window.update
  1175.     @difficulty_window.update
  1176.    
  1177.    
  1178.     if @difficulty_window.active
  1179.       @help_window.update
  1180.       update_difficulty_window
  1181.       return
  1182.     end
  1183.    
  1184.     # If C button was pressed
  1185.     if Input.trigger?(Input::C)
  1186.       # Branch by command window cursor position
  1187.       case @command_window.index
  1188.      
  1189.       when 0  # New game
  1190.         # Play decision SE
  1191.         $game_system.se_play($data_system.decision_se)
  1192.         @difficulty_window.visible = true
  1193.         @difficulty_window.active = true
  1194.         @help_window.visible = true
  1195.         @command_window.visible = false
  1196.         @command_window.active = false
  1197.         return
  1198.  
  1199.       when 1  # Continue
  1200.         command_continue
  1201.        
  1202.       when 2  # Shutdown
  1203.         command_shutdown
  1204.    
  1205.       end
  1206.     end
  1207.    
  1208.     if @command_window.methods.include?('selection')
  1209.       condition = '@command_window.selection == Vocab::new_game'
  1210.     else
  1211.       condition = '@command_window.index == 0'
  1212.     end
  1213.    
  1214.     if Input.trigger?(Input::C) && eval(condition)
  1215.       if !@difficulty_window.active && Difficulty::In_Title
  1216.       end
  1217.     end
  1218.  
  1219.   end
  1220.  
  1221.   #--------------------------------------------------------------------------
  1222.   # * Command: New Game
  1223.   # modified to active dif switch when $game is created
  1224.   #--------------------------------------------------------------------------
  1225.   alias wep_dif_command_new_game command_new_game
  1226.   def command_new_game(id)
  1227.     wep_dif_command_new_game
  1228.     $game_switches[Difficulty::Switches[id]] = true
  1229.   end
  1230.  
  1231.   #--------------------------------------------------------------------------
  1232.   # * Frame Update (Difficulty)
  1233.   #--------------------------------------------------------------------------
  1234.   def update_difficulty_window
  1235.     # Diff id = window index
  1236.     id = $game_system.difficulty_id = @difficulty_window.index
  1237.    
  1238.     # Back
  1239.     if Input.trigger?(Input::B)
  1240.       # Play  SE
  1241.       $game_system.se_play($data_system.cancel_se)
  1242.       @difficulty_window.visible = false
  1243.       @difficulty_window.active = false
  1244.       @command_window.visible = true
  1245.       @command_window.active = true
  1246.      
  1247.     # Select diff
  1248.     elsif Input.trigger?(Input::C)
  1249.       @difficulty_window.dispose
  1250.       @help_window.dispose
  1251.       # Active difficulty effect and swithch
  1252.       $game_system.difficulty_effects[Difficulty::Effects[id]][:active] = true
  1253.      
  1254.       command_new_game(id)
  1255.     else
  1256.       @help_window.set_text(Difficulty::Descriptions[id])
  1257.     end
  1258.    
  1259.  
  1260.   end
  1261. end
  1262.  
  1263.  
  1264.  
  1265. end
Advertisement
Add Comment
Please, Sign In to add comment