立即注册 登录
URPGs 返回首页

lbq的个人空间 https://urpgs.com/?197 [收藏] [复制] [分享] [RSS]

日志

属性抗性和攻击属性的随机

热度 1已有 1341 次阅读2014-3-7 13:20

#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
1

Like

Dislike

刚表态过的朋友 (1 人)

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 立即注册

站点统计|Archiver|意见反馈[feedback]| URPGs RPG Maker 游戏制作讨论

GMT+8, 2023-6-5 22:32 , Processed in 0.029759 second(s), 14 queries .

Powered by Discuz! X3.4

© 2011-2019 URPGs (Discuz! X3.4 © 2001-2019 Comsenz Inc.)

返回顶部