IceDragon200

=w=

May 24th, 2011
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 11.58 KB | None | 0 0
  1. #----------------------------------------------------------------------------|
  2. #                                                                            |
  3. #                     + HungrySnake's Attack Formula +                       |
  4. #                                                                            |
  5. #----------------------------------------------------------------------------|
  6. #                                                                            |
  7. # This Script allows you to change the 'hit_damage' of your actors. It's     |
  8. # simple, but effective! You can change it to what you want!                 |
  9. #                                                                            |
  10. #----------------------------------------------------------------------------|
  11. #                                                                            |
  12. #                          + Start Customization +                           |
  13. #                                                                            |
  14. #----------------------------------------------------------------------------|                                                                          
  15.  
  16.  
  17. module CONFIG
  18.   # Formule for Damage = CHARACTER_ATTACK x DAMAGE(SEE BELOW) - CHARACHTER_
  19.   # DEFENCE x DEFENCE(SEE BELOW)
  20.  
  21.   DAMAGE = 40 # Normal damage value = 4
  22.   DEFENCE = 10 # Normal defence value = 1
  23.   BASE_DAMAGE = false # Turn true to enable BASE_DAMAGE_VALUE
  24.   BASE_DAMAGE_VALUE = 10 # Value for a Base Damage (damage you set without
  25.                          # using a formule).
  26.   ENABLE_RANDOM_FORMULES = true # Turn to false if you don't want to switch
  27.                                 # the formules each time a turn ends.
  28.  
  29.   # FOR THE ADVANCED ONES:
  30.  
  31.   # The system works like this:
  32.   # The abbreviations are just for the description
  33.   # ATTACK_POINTS_ACTOR = APA
  34.   # "TOKENATK" = TA (EDIT BENEATH)
  35.   # DAMAGE = DMG (EDIT ABOVE)
  36.   # "TOKENDEF" = TD (EDIT BENEATH)
  37.   # DEFENCE_POINTS_ACTOR = DPA
  38.   # "TOKENDEF2" = TD2 (EDIT BENEATH)
  39.   # DEFENCE = DEF (EDIT ABOVE)
  40.   # "DMG_FORMULA = APA TA DMG TD DPA TD2 DEF"
  41.  
  42.   # MANUAL:
  43.  
  44.   # You can change the tokens beneath this, but you must set the TOKEN_ENABLE
  45.   # of your Formule you want to change to "true".
  46.   # You can choose between: *, /, +, - or other math tokens.
  47.   # Example:
  48.   # TOKEN_ENABLE1 = true
  49.   # I am here enabling to turn the switch on to change the tokens in
  50.   # Formule 2,
  51.   # TOKENATK1 =  /
  52.   # TOKENDEF2 =  *
  53.   # TOKENDEF3 =  +
  54.   # You will get different hits each time you change
  55.   # the tokens.
  56.   DAMAGE_PROC1 = Proc.new { |attacker, target| attacker.atk * DAMAGE * target.def * DEFENCE }
  57.   DAMAGE_PROC2 = Proc.new { |attacker, target| attacker.atk * DAMAGE - target.def * DEFENCE }
  58.   DAMAGE_PROC3 = Proc.new { |attacker, target| attacker.atk * DAMAGE / target.def * DEFENCE }
  59.   TOKEN_ENABLE  = true
  60.   TOKEN_ENABLE1 = true
  61.   TOKEN_ENABLE2 = true
  62. =begin  
  63.   # Formule 1 Tokens:
  64.   TOKEN_ENABLE = false # Preferably don't change if you don't know what u're doing.
  65.   TOKENATK = * # Token for attack
  66.   TOKENDEF = * # Token for defence
  67.   TOKENDEF1 = * # Token for defence 1
  68.  
  69.   # Formule 2 Tokens:  
  70.   TOKEN_ENABLE1 = false # Preferably don't change if you don't know what u're doing.
  71.   TOKENATK1 = * # Token for attack 1
  72.   TOKENDEF2 = * # Token for defence 2
  73.   TOKENDEF3 = * # Token for defence 3
  74.  
  75.   # Formule 3 Tokens:
  76.   TOKEN_ENABLE2 = false # Preferably don't change if you don't know what u're doing.
  77.   TOKENATK2 = * # Token for attack 2
  78.   TOKENDEF4 = * # Token for defence 4
  79.   TOKENDEF5 = * # Token for defence 5
  80. =end  
  81. end
  82.  
  83. #----------------------------------------------------------------------------|
  84. #                                                                            |
  85. #                           + End Customization +                            |
  86. #                                                                            |
  87. #----------------------------------------------------------------------------|
  88.  
  89. class Game_Battler
  90.  
  91. #----------------------------------------------------------------------------|
  92. #                                                                            |
  93. #                      + Cleavage of Types of Formules +                     |
  94. #                                                                            |
  95. #----------------------------------------------------------------------------|
  96.  
  97.   def make_attack_damage_value(attacker)
  98.  
  99.     if CONFIG::BASE_DAMAGE == true
  100.       command_basedamage(attacker)
  101.     else
  102.       command_formuledamage(attacker)
  103.     end
  104.   end  
  105.  
  106. #----------------------------------------------------------------------------|
  107. #                                                                            |
  108. #                           + Formule Damage 1 +                             |
  109. #                                                                            |
  110. #----------------------------------------------------------------------------|
  111.  
  112.   def command_formuledamage(attacker)
  113.     if CONFIG::TOKEN_ENABLED == true
  114.       cnf = CONFIG
  115.       damage = cnf::DAMAGE_PROC1.call( attacker, user )
  116.       damage = 0 if damage < 0                                                  
  117.       damage *= elements_max_rate(attacker.element_set)                          
  118.       damage /= 100
  119.       if damage == 0                                                            
  120.         damage = rand(2)                                                          
  121.       elsif damage > 0                                                            
  122.         @critical = (rand(100) < attacker.cri)                                    
  123.         @critical = false if prevent_critical                                    
  124.         damage *= 3 if @critical                                                  
  125.       end
  126.       damage = apply_variance(damage, 20)                                        
  127.       damage = apply_guard(damage)                                                
  128.       @hp_damage = damage  
  129.     else
  130.       command_basedamage(attacker)
  131.     end                                                        
  132.   end
  133.  
  134. #----------------------------------------------------------------------------|
  135. #                                                                            |
  136. #                           + Formule Damage 2 +                             |
  137. #                                                                            |
  138. #----------------------------------------------------------------------------|
  139.  
  140.   def command_formuledamage2(attacker)
  141.     if CONFIG::TOKEN_ENABLED1 == true
  142.       cnf = CONFIG
  143.       damage = cnf::DAMAGE_PROC2.call( attacker, user )
  144.       damage = 0 if damage < 0                                                  
  145.       damage *= elements_max_rate(attacker.element_set)                          
  146.       damage /= 100
  147.       if damage == 0                                                            
  148.         damage = rand(2)                                                          
  149.       elsif damage > 0                                                            
  150.         @critical = (rand(100) < attacker.cri)                                    
  151.         @critical = false if prevent_critical                                    
  152.         damage *= 3 if @critical                                                  
  153.       end
  154.       damage = apply_variance(damage, 20)                                        
  155.       damage = apply_guard(damage)                                                
  156.       @hp_damage = damage  
  157.     else
  158.       command_basedamage(attacker)
  159.     end  
  160.   end
  161.  
  162. #----------------------------------------------------------------------------|
  163. #                                                                            |
  164. #                           + Formule Damage 3 +                             |
  165. #                                                                            |
  166. #----------------------------------------------------------------------------|
  167.  
  168.   def command_formuledamage3(attacker)
  169.     if CONFIG::TOKEN_ENABLED2 == true
  170.       cnf = CONFIG
  171.       damage = cnf::DAMAGE_PROC3.call( attacker, user )
  172.       damage = 0 if damage < 0                                                  
  173.       damage *= elements_max_rate(attacker.element_set)                          
  174.       damage /= 100
  175.       if damage == 0                                                            
  176.         damage = rand(2)                                                          
  177.       elsif damage > 0                                                            
  178.         @critical = (rand(100) < attacker.cri)                                    
  179.         @critical = false if prevent_critical                                    
  180.         damage *= 3 if @critical                                                  
  181.       end
  182.       damage = apply_variance(damage, 20)                                        
  183.       damage = apply_guard(damage)                                                
  184.       @hp_damage = damage  
  185.     else
  186.       command_basedamage(attacker)                                                        
  187.     end  
  188.   end
  189.  
  190. #----------------------------------------------------------------------------|
  191. #                                                                            |
  192. #                                + Base Damage +                             |
  193. #                                                                            |
  194. #----------------------------------------------------------------------------|  
  195.  
  196.   def command_basedamage(attacker)
  197.     damage = CONFIG::BASE_DAMAGE_VALUE + rand(100)
  198.     if damage == 0                                
  199.       damage = rand(2)                            
  200.     elsif damage > 0                              
  201.       @critical = (rand(100) < attacker.cri)      
  202.       @critical = false if prevent_critical        
  203.       damage *= 3 if @critical
  204.       damage = apply_variance(damage, 20)            
  205.       damage = apply_guard(damage)                    
  206.       @hp_damage = damage    
  207.     end
  208.   end
  209.  
  210. end
  211.  
  212.  
  213. class Scene_Battle
  214. #----------------------------------------------------------------------------|
  215. #                                                                            |
  216. #          + Switch to another Formule @ the end of the round +              |
  217. #                                                                            |
  218. #----------------------------------------------------------------------------|
  219.   def turn_end
  220.     $game_troop.turn_ending = true
  221.     $game_party.slip_damage_effect
  222.     $game_troop.slip_damage_effect
  223.     $game_party.do_auto_recovery
  224.     $game_troop.preemptive = false
  225.     $game_troop.surprise = false
  226.     process_battle_event
  227.     $game_troop.turn_ending = false
  228.     start_party_command_selection
  229.     if CONFIG::ENABLE_RANDOM_FORMULES == true
  230.       case rand(2)
  231.       when 0
  232.         command_formuledamage(attacker)
  233.       when 1
  234.         command_formuledamage2(attacker)
  235.       when 2
  236.         command_formuledamage3(attacker)
  237.       end
  238.     end  
  239.   end
  240.  
  241. end
  242.  
  243. #----------------------------------------------------------------------------|
  244. # END//END//END//END//END//END//END//END//END//END//END//END//END//END//END  |
  245. # END//END//END//END//END//END//END//END//END//END//END//END//END//END//END  |                    
  246. # END//END//END//END//END//END//END//END//END//END//END//END//END//END//END  |                                                                           |
  247. #----------------------------------------------------------------------------|
Advertisement
Add Comment
Please, Sign In to add comment