Guest User

Untitled

a guest
Jun 19th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.91 KB | None | 0 0
  1. #==============================================================================## ▼ Gamesfreak13563 - Item Stats Bonus# -- Last Updated: 2011.12.27##==============================================================================#==============================================================================# ■ Options#==============================================================================module GF  module ITEMBONUS            DEFAULT_GROWTH ={    # ParamID => [:param, +set],                    0 => [:maxhp,    0],                    1 => [:maxmp,    0],                    2 => [  :atk,    0],                    3 => [  :def,    0],                    4 => [  :mat,    0],                    5 => [  :mdf,    0],                    6 => [  :agi,    0],                    7 => [  :luk,    0],    } # Do not remove this.  end #ITEMBONUSend #GF#==============================================================================# ■ Tags#==============================================================================module GF  module ITEMBONUS  module BASEITEM        GROWTH_SET = /<(.*):[ ]([\+\-]\d+)[ ](?:BONUS|bonus)>/i      end # BASEITEM  end # ITEMBONUSend # GF#===========================================================================# ■ DataManager#===========================================================================module DataManager      #--------------------------------------------------------------------------    # ● Loads the database    #--------------------------------------------------------------------------    class << self        alias_method(:gf_itembonus_load_database, :load_database) unless $@    end    def self.load_database        gf_itembonus_load_database        load_bonus_notetags    end      #--------------------------------------------------------------------------    # ● Loads the note tags    #--------------------------------------------------------------------------    def self.load_bonus_notetags        groups = [$data_weapons, $data_armors]        classes = [RPG::Weapon, RPG::Armor]        for group in groups            for obj in group                next if obj.nil?                obj.load_bonus_notetags if classes.include?(obj.class)            end        end    endend#==========================================================================#  ■  RPG::Weapon#==========================================================================class RPG::Weapon < RPG::EquipItem  #--------------------------------------------------------------------------  # public instance variables  #--------------------------------------------------------------------------  attr_reader :level_growth  #--------------------------------------------------------------------------  # common cache: load_bonus_notetags  #--------------------------------------------------------------------------  def load_bonus_notetags    @level_growth = GF::ITEMBONUS::DEFAULT_GROWTH.clone    #---    self.note.split(/[\r\n]+/).each { |line|          case line          #---          when GF::ITEMBONUS::BASEITEM::GROWTH_SET            case $1.upcase            when "MAXHP", "MHP", "HP"                  type = 0            when "MAXMP", "MMP", "MP", "MAXSP", "MSP", "SP"                  type = 1            when "ATK", "ATTACK"                  type = 2            when "DEF", "DEFENSE"                  type = 3            when "MAT", "MAGIC ATTACK", "INT", "INTELLIGENCE", "SPI", "SPIRIT"                  type = 4            when "MDF", "MAGIC DEFENSE", "RES", "RESISTANCE"                  type = 5            when "AGI", "AGILITY"                  type = 6            when "LUK", "LUCK"                  type = 7            else; next            end            @level_growth[type][1] = $2.to_i          end    } # self.note.split    #---  end end # RPG::Enemy#==========================================================================#  ■  RPG::Armor#==========================================================================class RPG::Armor < RPG::EquipItem  #--------------------------------------------------------------------------  # public instance variables  #--------------------------------------------------------------------------  attr_reader :level_growth   #--------------------------------------------------------------------------  # common cache: load_bonus_notetags  #--------------------------------------------------------------------------  def load_bonus_notetags    @level_growth = GF::ITEMBONUS::DEFAULT_GROWTH.clone    #---    self.note.split(/[\r\n]+/).each { |line|          case line          #---          when GF::ITEMBONUS::BASEITEM::GROWTH_SET            case $1.upcase            when "MAXHP", "MHP", "HP"                  type = 0            when "MAXMP", "MMP", "MP", "MAXSP", "MSP", "SP"                  type = 1            when "ATK", "ATTACK"                  type = 2            when "DEF", "DEFENSE"                  type = 3            when "MAT", "MAGIC ATTACK", "INT", "INTELLIGENCE", "SPI", "SPIRIT"                  type = 4            when "MDF", "MAGIC DEFENSE", "RES", "RESISTANCE"                  type = 5            when "AGI", "AGILITY"                  type = 6            when "LUK", "LUCK"                  type = 7            else; next            end            @level_growth[type][1] = $2.to_i          end    } # self.note.split    #---  end end # RPG::Enemy#==========================================================================#  ■  Game_Actor#========================================================================== class Game_Actor < Game_Battler  def level_up_sum    for f in 0..5    if @equips[f].object != nil          item1 = @equips[f].object          puts @equips[f].object            for i in 0..7                    add_param(i, item1.level_growth[i][1])                    puts item1.level_growth[i][1]            end          end    end  end  def level_up    @level += 1    level_up_sum    self.class.learnings.each do |learning|          learn_skill(learning.skill_id) if learning.level == @level    end  end end
Add Comment
Please, Sign In to add comment