Advertisement
roninator2

Yanfly Skill Cost Manager - MP Cost Rate

Dec 4th, 2024
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.59 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Skill Cost Manager v1.03.1     add on
  4. # -- Last Updated: 2019.06.06
  5. # -- Level: Normal, Hard, Lunatic
  6. # -- Requires: n/a
  7. # -- add on by Roninator2
  8. #==============================================================================
  9. # ▼ Updates
  10. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  11. # 2019.06.06 - added on mp cost rate
  12. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  13. # -----------------------------------------------------------------------------
  14. # Actor Notetags - These notetags go in the actors notebox in the database.
  15. # -----------------------------------------------------------------------------
  16. # <mp cost rate: x%>
  17. # Allows the actor to drop the MP cost of skills to x%.
  18. # -----------------------------------------------------------------------------
  19. # Class Notetags - These notetags go in the class notebox in the database.
  20. # -----------------------------------------------------------------------------
  21. # <mp cost rate: x%>
  22. # Allows the class to drop the MP cost of skills to x%.
  23. # -----------------------------------------------------------------------------
  24. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  25. # -----------------------------------------------------------------------------
  26. # <mp cost rate: x%>
  27. # Allows the weapon to drop the MP cost of skills to x% when worn.
  28. # -----------------------------------------------------------------------------
  29. # Armour Notetags - These notetags go in the armours notebox in the database.
  30. # -----------------------------------------------------------------------------
  31. # <mp cost rate: x%>
  32. # Allows the armour to drop the MP cost of skills to x% when worn.
  33. # -----------------------------------------------------------------------------
  34. # State Notetags - These notetags go in the states notebox in the database.
  35. # -----------------------------------------------------------------------------
  36. # <mp cost rate: x%>
  37. # Allows the state to drop the MP cost of skills to x% when afflicted.
  38.  
  39. module YEA
  40.   module REGEXP
  41.   module BASEITEM
  42.     MP_COST_RATE = /<(?:MP_COST_RATE|mp cost rate):[ ](\d+)([%])>/i
  43.   end
  44.   end
  45. end
  46.  
  47. class RPG::BaseItem
  48.   #--------------------------------------------------------------------------
  49.   # public instance variables
  50.   #--------------------------------------------------------------------------
  51.   attr_accessor :mp_cost_rate
  52.   #--------------------------------------------------------------------------
  53.   # common cache: load_notetags_scm
  54.   #--------------------------------------------------------------------------
  55.   alias r2_load_notetags_scm_8237fg   load_notetags_scm
  56.   def load_notetags_scm
  57.     r2_load_notetags_scm_8237fg
  58.     @mp_cost_rate = 1.0
  59.     #---
  60.     self.note.split(/[\r\n]+/).each { |line|
  61.       case line
  62.       #---
  63.       when YEA::REGEXP::BASEITEM::MP_COST_RATE
  64.         @mp_cost_rate = $1.to_i * 0.01
  65.       end
  66.     }
  67.   end
  68. end
  69.  
  70. class Game_BattlerBase
  71.   def mcr#;  sparam(4);  end               # MCR  Mp Cost Rate
  72.     n = 1.0
  73.     if actor?
  74.       n *= self.actor.mp_cost_rate
  75.       n *= self.class.mp_cost_rate
  76.       for equip in equips
  77.         next if equip.nil?
  78.         n *= equip.mp_cost_rate
  79.       end
  80.     else
  81.       n *= self.enemy.mp_cost_rate
  82.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  83.         n *= self.class.mp_cost_rate
  84.       end
  85.     end
  86.     for state in states
  87.       next if state.nil?
  88.       n *= state.mp_cost_rate
  89.     end
  90.     return n
  91.   end
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement