#encoding:utf-8
#==============================================================================
# ■ Random Attributes by ISLBQ
#------------------------------------------------------------------------------
# Added random attack elements and element resistance to enemies
#==============================================================================
# 2014-3-6 Started and Finished
#==============================================================================
class Game_Enemy
alias :lbq_game_enemy_random_attribute_init :initialize
def initialize(*args)
lbq_game_enemy_random_attribute_init(*args)
@my_random_attribute = rand($data_system.elements.length-1) + 1
end
#--------------------------------------------------------------------------
# ● 获取攻击附加属性
#--------------------------------------------------------------------------
alias :ori_atk_elements_game_enemy_lbq_random_attribute :atk_elements
def atk_elements(*args)
return [@my_random_attribute] if ori_atk_elements_game_enemy_lbq_random_attribute.empty?
ori_atk_elements_game_enemy_lbq_random_attribute(*args)
end
end
class Game_Enemy
alias :lbq_game_enemy_random_attribute_init_2 :initialize
def initialize(*args)
lbq_game_enemy_random_attribute_init_2(*args)
@random_element_rates = []
($data_system.elements.length-1).times do |i|
@random_element_rates[i+1] = (rand(400)/100.0 - 2.0).round(1)
end
end
#--------------------------------------------------------------------------
# ● 获取属性抗性
#--------------------------------------------------------------------------
alias :lbq_game_enemy_random_attribute_element_rate :element_rate
def element_rate(*args)
if lbq_game_enemy_random_attribute_element_rate(*args) == 1.0
puts @random_element_rates[args[0]]
return @random_element_rates[args[0]]
end
end
end