Guest User

Untitled

a guest
Jun 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.60 KB | None | 0 0
  1. class Game_Battler < Game_BattlerBase
  2.   MAX_YCTB_VALUE = 100000.0
  3.   def lunatic_yctb_strike_formula
  4.     formulas = []
  5.     formulas = self.current_action.item.yctb_strike
  6.     value = 0
  7.     for formula in formulas
  8.       case formula.upcase
  9.       when /STRIKE VALUE[ ](\d+)/i
  10.         value = -$1.to_i
  11.       when /COMMON RESET/i
  12.         value = 0
  13.       end
  14.     end
  15.     return value
  16.   end
  17.   alias yctbstrike_item_apply item_apply
  18.   def item_apply(user, item)
  19.     yctbstrike_item_apply(user, item)
  20.     @yctb_value+=lunatic_yctb_strike_formula
  21.   end
  22. end
  23. module DataManager
  24.   class <<self; alias load_database_yctbstrike load_database; end
  25.   def self.load_database
  26.     load_database_yctbstrike
  27.     load_notetags_yctbstrike
  28.   end
  29.   def self.load_notetags_yctbstrike
  30.     groups = [$data_skills, $data_items]
  31.     for group in groups
  32.       for obj in group
  33.         next if obj.nil?
  34.         obj.load_notetags_yctbstrike
  35.       end
  36.     end
  37.   end
  38. end
  39. class RPG::UsableItem < RPG::BaseItem
  40.   attr_accessor :yctb_strike
  41.   def load_notetags_yctbstrike
  42.     @yctb_strike = []
  43.     @yctb_strike_on = false
  44.     self.note.split(/[\r\n]+/).each { |line|
  45.       case line
  46.       when /<(?:CUSTOM_YCTB_STRIKE|custom yctb strike):[ ](.*)>/i
  47.         @yctb_strike.push($1.to_s)
  48.       when /<(?:CUSTOM_YCTB_STRIKE|custom yctb strike)>/i
  49.         @yctb_strike_on = true
  50.       when /<\/(?:CUSTOM_YCTB_STRIKE|custom yctb strike)>/i
  51.         @yctb_strike_on = false
  52.       else
  53.         @yctb_strike.push(line.to_s) if @yctb_strike_on
  54.       end
  55.     }
  56.     @yctb_strike.push("COMMON RESET") if @yctb_strike == []
  57.   end
  58. end
Add Comment
Please, Sign In to add comment