#============================================================================== =begin # 精英敌人,作者:66RPG的tan12345 # 功能:遇敌时,敌人有一定几率(可设定)变成精英,精英怪比普通怪属性有加成(可修改), # 当然了,精英怪的经验、金钱、掉落率也同样有加成。 # 也可以设定指定的敌人不会变成精英(比如BOSS) # # 使用方法:将脚本插入到main上 # =end module Tan_by_enemy_set #精英怪出现几率,30代表30% Tan_enemy_by = 45 #精英怪属性加成比例(同时也是经验、金钱、掉落率加成比例),1.3代表属性是普通怪的1.3倍 Tan_enemy_by_num = 1.8 #不会成为精英的敌人 NO_BY_ENEMY = [474,475]#表示2号和3号敌人不会变成精英,适合设定BOSS end class Game_Enemy < Game_Battler attr_reader :is_by # 是否精英 #-------------------------------------------------------------------------- # ● 精英初始化 #-------------------------------------------------------------------------- def init_by_enemy @is_by = false @is_by = true if rand(100) <= Tan_by_enemy_set::Tan_enemy_by && !Tan_by_enemy_set::NO_BY_ENEMY.include?(enemy_id) @original_name = @original_name + "(猛)" if @is_by == true @hp = mhp @mp = mmp end #-------------------------------------------------------------------------- # ● 是否精英 #-------------------------------------------------------------------------- def is_by? return true if @is_by return false end #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- alias tan_by_enemy_initialize initialize def initialize(index, enemy_id) tan_by_enemy_initialize(index, enemy_id) init_by_enemy end #-------------------------------------------------------------------------- # ● 获取普通能力的基础值 #-------------------------------------------------------------------------- alias tan_by_enemy_param_base param_base def param_base(param_id) v = tan_by_enemy_param_base(param_id) v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by? return v.to_i end #-------------------------------------------------------------------------- # ● 获取经验值 #-------------------------------------------------------------------------- alias tan_by_enemy_exp exp def exp v = tan_by_enemy_exp v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by? return v.to_i end #-------------------------------------------------------------------------- # ● 获取金钱 #-------------------------------------------------------------------------- alias tan_by_enemy_gold gold def gold v = tan_by_enemy_gold v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by? return v.to_i end #-------------------------------------------------------------------------- # ● 获取物品掉率的倍率 #-------------------------------------------------------------------------- alias tan_by_enemy_drop_item_rate drop_item_rate def drop_item_rate v = tan_by_enemy_drop_item_rate v *= Tan_by_enemy_set::Tan_enemy_by_num if is_by? return v end end
#-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- alias tan_by_enemy_initialize initialize def initialize(index, enemy_id) tan_by_enemy_initialize(index, enemy_id) init_by_enemy end
#常量定义 module Tan_by_enemy_set ELITE_TROOPS = [1,2,3,4,5] #设置生成精英怪的敌群ID end class Game_Troop < Game_Unit #敌群生成机制 def setup(troop_id) clear @troop_id = troop_id @enemies = [] troop.members.each do |member| next unless $data_enemies[member.enemy_id] enemy = Game_Enemy.new(@enemies.size, member.enemy_id) enemy.init_by_enemy if Tan_by_enemy_set::ELITE_TROOPS.include?(troop_id) #判定是否BOSS敌群,然后尝试生成精英怪 enemy.hide if member.hidden enemy.screen_x = member.x enemy.screen_y = member.y @enemies.push(enemy) end init_screen_tone make_unique_names end end
QQ图片20170101140944.png (8.94 KB, 下载次数: 24)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |