neonblack

Zombie State

Aug 16th, 2012
997
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Game_BattlerBase
  2.   def rec; check_for_zombie ? sparam(2) * -1 : sparam(2); end
  3.   def check_for_zombie; @states.any? {|st| $data_states[st].zombie}; end
  4. end
  5.  
  6.  
  7. class RPG::State < RPG::BaseItem
  8.   ZOMB = /\[zombie\]/i
  9.   attr_reader :zombie
  10.  
  11.   def set_zombie
  12.     return if @zombie_check; @zombie_check = true
  13.     @zombie = false
  14.     self.note.split(/[\r\n]+/).each do |line|
  15.       case line
  16.       when ZOMB
  17.         @zombie = true
  18.       end
  19.     end
  20.   end
  21. end
  22.  
  23. module DataManager
  24.   class << self
  25.     alias load_database_cpz load_database unless $@
  26.   end
  27.  
  28.   def self.load_database
  29.     load_database_cpz
  30.     check_zomb
  31.   end
  32.  
  33.   def self.check_zomb
  34.     groups = [$data_states]
  35.     for group in groups
  36.       for obj in group
  37.         next if obj == nil
  38.         obj.set_zombie if obj.is_a?(RPG::State)
  39.       end
  40.     end
  41.   end
  42. end
RAW Paste Data