Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ■ Damage Formula Extension
- # FormulaExtend.rb
- #------------------------------------------------------------------------------
- # More functions that can be used for damage formula calculation.
- #
- # ●How to usea
- # 1. Input function for skill damage formula in database. Example(a.plus_atk)
- #
- # ●Formula functions list
- # 1. plus_atk(percent, value)
- # [percent]Calculate by value to original attack power with a chance of.
- # ex:a.plus_atk(50, 100) # 50% chance to add 100 to the attacker's attack power.
- #
- # 2. plus_def(percent, value)
- # [percent]Calculate by value to original defense with a chance of.
- # ex:b.plus_def(30, -100) # 30% chance to subtract 100 from the target's def.
- #
- # 3. plus_mat(percent, value)
- # [percent]Calculate by value to original magic attack with a chance of.
- #
- # 4. plus_mdf(percent, value)
- # [percent]Calculate by value to original magic defense power with a chance of.
- #
- # 5. plus_agi(percent, value)
- # [percent]Calculate by value to original agility with a chance of.
- #
- # 6. plus_luk(percent, value)
- # [percent]Calculate by value to original luck with a chance of.
- #
- # ●Terms of use
- # It can be modified and redistributed without permission from the author.
- # Free for commercial and non-commercial use.
- #-----------------------------------------------------------------------------
- # Copyright (c) 2017 Triacontane
- # This software is released under the MIT License.
- # http://opensource.org/licenses/mit-license.php
- #-----------------------------------------------------------------------------
- # Version
- # 1.0.0 2017/01/28 initial release
- # ----------------------------------------------------------------------------
- # [Blog] : http://triacontane.blogspot.jp/
- # [Twitter]: https://twitter.com/triacontane/
- # [GitHub] : https://github.com/triacontane/
- #=============================================================================
- class Game_Battler < Game_BattlerBase
- #--------------------------------------------------------------------------
- # ● extra parameter
- #--------------------------------------------------------------------------
- def plus_param(original, percent, adjustment)
- return [original + (rand(100) < percent ? adjustment : 0), 0].max
- end
- #--------------------------------------------------------------------------
- # ● add attack
- #--------------------------------------------------------------------------
- def plus_atk(percent, adjustment)
- return plus_param(self.atk, percent, adjustment)
- end
- #--------------------------------------------------------------------------
- # ● add defense
- #--------------------------------------------------------------------------
- def plus_def(percent, adjustment)
- return plus_param(self.def, percent, adjustment)
- end
- #--------------------------------------------------------------------------
- # ● add magic attack
- #--------------------------------------------------------------------------
- def plus_mat(percent, adjustment)
- return plus_param(self.mat, percent, adjustment)
- end
- #--------------------------------------------------------------------------
- # ● add magic defense
- #--------------------------------------------------------------------------
- def plus_mdf(percent, adjustment)
- return plus_param(self.mdf, percent, adjustment)
- end
- #--------------------------------------------------------------------------
- # ● add agility
- #--------------------------------------------------------------------------
- def plus_agi(percent, adjustment)
- return plus_param(self.agi, percent, adjustment)
- end
- #--------------------------------------------------------------------------
- # ● add luck
- #--------------------------------------------------------------------------
- def plus_luk(percent, adjustment)
- return plus_param(self.luk, percent, adjustment)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement