设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2961|回复: 3
打印 上一主题 下一主题

[已经解决] VA有敌人能力自动设置这个脚本吗?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
80 小时
注册时间
2011-1-21
帖子
85
跳转到指定楼层
1
发表于 2012-7-23 06:20:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
以下是我复制的,这个脚本是对应VX的 感觉不错,在VA没有找到,请问下VA有类似的脚本吗?

使用方法:写在脚本注释里了
使用之後,在敌人数据库里只要设置掉落物、掉落金钱、属性、抵抗状态、和行动而已
其他的如HP、MP等,全部帮你搞定,从此再也不用烦恼敌人的设置了{/cy}{/wx}

冲突可能:修改了Game_Enemy的脚本
大概也只有日站上的战斗难度脚本吧?

与小幽的敌人战斗AI无冲突,除了某种原因会54强度标签以外
正在修改中

3/26 V 2.05
与小幽的战斗AI整合,完全可以与其配合使用
参考了该脚本内敌人种类设定,增加了种类标签
设定种类後会变更各项能力值

3/27 V 2.1
- 更新修改强度标签的问题

4/1 V2.5
- 更新强度标签判断问题
- 更新等级累加计算
- 更新标签叠加效果
- 更新类型能力判断,可以直接在设定部分修改
- 更新掉落物品计算,不过还要配合物品设定脚本,因此尚未能使用

=begin
================================================================================
使用方法:
    1. 敌人等级直接设定
   
    在敌人的备注栏里打上
   
    [等级 n]
   
    例如:[等级 25]
    n 为该敌人等级。(「等级」二字简繁体皆可,也可以打成英文的 level)
   
    2. 敌人等级与角色队伍平均等级相同
   
    在敌人的备注栏里打上

    [主角等级]
   
    则自动依队伍平均等级计算该敌人等级
    (「主角等级」四字可以为简繁体,或是英文的 player_level)

    3. 敌人等级为角色队伍平均等级的差距
   
    在敌人的备注栏里打上

    [强度 X]
   
    例如:[强度 很弱]
    X 为下面的哈希表所设置的强度,可以自己修改,
    (「强度」二字可以为简繁体,或是英文的 strength)
   
    强度标签单独使用时,是使用主角队伍平均等级计算
    若是与等级标签同用,则是以该等级计算
    详细看下面的范例设定。
   
    4. 敌人类型
      (其实是参考了小幽的战斗AI脚本,可以配合该脚本使用
        在战斗AI里设定好的类型,这里就不用再设定一次了
        如果读取到了战斗AI脚本的敌人类型,就会忽略数据库里的设定。)
      
    在敌人的备注栏里打上

    [类型 X]
   
    例如:[类型 巫师]
    X 为下面的哈希表所设置的强度,可以自己修改,
    (「类型」二字可以为简繁体,或是英文的 type)
   
    5. 经验值系数设定
      EXPERIENCE 是设定一般敌人经验值
        0.1 表示所得经验值为角色队伍在该等级所需升级的经验值数的十分之一
      BOSS_EXP   是设定BOSS敌人经验值
        3 表示计算经验值後再加值计算的经验值
   
    6. 哈希表设置部分说明
      ENEMY_TYPE 哈希表
        字符部分为类型,可以修改,数字部分为类型代号,不要修改
  
      STRENGTH 哈希表
        字符部分为强度,数字部分为与主角平均等级差
        
      例如:"很弱" =>  -3
   
      表示当敌人强度设为「很弱」时,该敌人等级为队伍等级-3
   
      例如:
        1 角色  等级:3
        2 角色  等级:4
        3 角色  等级:8
        4 角色  等级:6
         怪物1设为 [强度 弱]
         怪物2设为 [很强 很强] [等级 1]
   
        那麽怪物1等级就是:
          (3+4+8+6)/4 = 5.25 <= 取整为5
          5 - 2 = 3          <= 怪物等级为3
         
        那麽怪物2等级就是:
          1 + 3 = 4          <= 怪物等级为4
        
      要注意的是,当等级为0或以下时则自动修正为1
      若无法在哈希表中找到相对应的key,就会将该敌人设置为与主角队伍平均等级相同
   
    配合使用方法:
   
    一般敌人建议用第一种方法,设立(伪)绝对等级,主角成长後依然为弱怪的敌人。
    头目敌人可以直接指定其类型为 BOSS,但是其能力值增值方面就比较死板,
      若是想做成巫师型的血低魔高的BOSS,可以用下面的方法
      
      用第二、三种方法,设立相对等级,主角成长也会跟着成长的敌人。
          设立为「弱」时,虽然对主角来说依然是弱怪,
          但是会随着主角成长,HP、MP、经验值会随着增加,
          可以用来做练级用的怪。
        
        
    调用敌人图鉴方式:
    在调用前先执行脚本 make_enemy_database
    只要 WRITE_2_DATABASE 设为 false
    就不会覆写数据库的资料,而是在游戏中调用而已。
    不过说明方面就会有点问题了
   
    覆写数据库方法:
    将WRITE_2_DATABASE 设为 true
    随意在地图上用一个事件执行 make_enemy_database
    再回到脚本将WRITE_2_DATABASE 设为 false(以免在运行中误操作)
   
=end

# 设置部分:
module Auto_Enemy
  
  # 是否写入数据库
  WRITE_2_DATABASE = false
  
  # 是否自動設置屬性有效度
  AUTO_SET_ELEMENT = true
  
  # 是否自動設定狀態抵禦度
  AUTO_SET_STATES  = true
  
  # 经验值计算系数
  EXPERIENCE = 0.1
  BOSS_EXP   = 3
  
  STRENGTH = {
      "很弱" =>  -3,
      "弱"   =>  -2,
      "同"   =>   1,
      "强"   =>   2,
      "很强" =>   3,
      "default" => 0  # 这行不要修改,除错用的
  }
  
  # 敌人类型设定
  ENEMY_TYPE = {
  
      "普通"   => 0,  # 普通敌人,能力值依队伍平均计算
      "武士"   => 1,  # 武士型敌人,物理攻击等偏高
      "法师"   => 2,  # 法师型敌人,魔法攻击偏高
      "牧师"   => 3,  # 牧师型敌人,魔力值偏高
      "巫师"   => 4,  # 巫师型敌人,命中率偏高
      "挡箭牌" => 5,  # 挡箭牌型敌人,血高肉厚
      "BOSS"   => 6,  # BOSS型敌人,各项能力值都增强
      # 以上的数值可以在下面的数组变更
      
      "随机"   => -1, # 随机,看看它的运气,加值在 1~1.99
      "default"=> 0   # 这行不要修改,除错用,默认为普通
  }
  
  # 敌人能力值加值参数,对应上放哈希表的敌人类型。不会改的话就别改了。
  #                 普通 武士  法师  牧师  巫师  档箭  BOSS
  ENEMY_TYPE_HP  = [1,   1.5,  0.75, 0.6,  0.8,  2,    4]  # 体力最大值
  ENEMY_TYPE_MP  = [1,   0.75, 1.5,  3,    1.4,  1.1,  4]  # 魔力最大值
  ENEMY_TYPE_ATK = [1,   2,    0.75, 0.5,  0.6,  1.1,  4]  # 攻击力
  ENEMY_TYPE_DEF = [1,   1.25, 0.5,  0.75, 0.7,  3,    4]  # 防御力
  ENEMY_TYPE_SPI = [1,   0.1,  2,    1.75, 1.5,  0,    2]  # 精神力
  ENEMY_TYPE_AGI = [1,   1.2,  2,    0.8,  1.1,  0.2,  2]  # 敏捷
  ENEMY_TYPE_HIT = [1,   1.3,  1.1,  1.5,  1.8,  1 ]       # 命中率
  ENEMY_TYPE_EVA = [1,   1,    1,    0.9,  1.1,  0 ]       # 闪躲率
                               # BOSS的命中率和闪躲率为默认最高的95%

end

class Game_Party
  def avg_number(number, level=nil)
    average = 0
    for i in @actors
      actor = level ? $data_actors : $game_actors
      case number
      when "level"
        average += $game_actors.level
      when "exp"
        average += $game_actors.next_exp_s
      when "hp"
        if level
          average += actor.parameters[0, level]
        else
          average += actor.maxhp
        end
      when "mp"
        if level
          average += actor.parameters[1, level]
        else
          average += actor.maxmp
        end
      when "atk"
        if level
          average += actor.parameters[2, level]
        else
          average += actor.atk
        end
      when "def"
        if level
          average += actor.parameters[3, level]
        else
          average += actor.def
        end
      when "spi"
        if level
          average += actor.parameters[4, level]
        else
          average += actor.spi
        end
      when "agi"
        if level
          average += actor.parameters[5, level]
        else
          average += actor.agi
        end
      when "hit"
        average += $game_actors.hit
      when "eva"
        average += $game_actors.eva
      end
    end
    average /= members.size
    return average
  end
  
  # 獲取平均等級
  def avg_level
    return avg_number("level")
  end
  
  # 獲取平均升級經驗
  def avg_exp_needed
    return avg_number("exp")
  end
  
  def avg_hp_max(level=nil)
    return avg_number("hp", level)
  end

  def avg_mp_max(level=nil)
    return avg_number("mp", level)
  end

  def avg_atk(level=nil)
    return avg_number("atk", level)
  end

  def avg_def(level=nil)
    return avg_number("def", level)
  end
  
  def avg_spi(level=nil)
    return avg_number("spi", level)
  end
  
  def avg_agi(level=nil)
    return avg_number("agi", level)
  end
  
  def avg_hit
    return avg_number("hit")
  end
  
  def avg_eva
    return avg_number("eva")
  end
end

class RPG::Enemy
  # 获取等级
  def get_level
    elevel = 0
    self.note.split(/[\r\n]+/).each { |line|
      if line =~ /\[(level|等級|等级) {1,2}\]/
        a = line.split(/ /)[1]
        elevel += a.to_i
      elsif line =~ /\[player_level|主角等級|主角等级\]/
        elevel += $game_party.avg_level
      end
    }
    return elevel==0 ? nil : elevel
  end
  
  # 获取强度
  def get_str
    self.note.split(/[\r\n]+/).each { |line|
      if line =~ /\[(strength|強度|强度) \w+\]/
        a = line.split(/ /)[1]
        d = ""
        while ((c = a.slice!(/./m)) != nil)
          d += c if c != "]"
        end
        return d
      end
    }
    return "default"
  end
  
  def get_enemy_type
    self.note.split(/[\r\n]+/).each { |line|
      if line =~ /\[(type|類型|类型) \w+\]/
        a = line.split(/ /)[1]
        d = ""
        while ((c = a.slice!(/./m)) != nil)
          d += c if c != "]"
        end
        return d
      end
    }
    return "default"
  end
  
  # 计算等级
  def level
    if auto_level?
      if auto_str?
        return [get_level + str, 1].max
      else
        return get_level
      end
    elsif auto_str?
      elevel = $game_party.avg_level + str
      return [elevel, 1].max
    end
  end
  
  def str
    estr = Auto_Enemy::STRENGTH[get_str]
    if estr != nil
      return estr
    else
      return Auto_Enemy::STRENGTH["default"]
    end
  end
  
  def type
    if $enemies_class != nil
      return $enemies_class[@enemy_id] if $enemies_class[@enemy_id]!=nil
    end
    return Auto_Enemy::ENEMY_TYPE[get_enemy_type]
  end
  
  def auto_level?
    return get_level
  end
  def auto_str?
    return get_str
  end
  def auto_setup?
    return (auto_level? or auto_str?)
  end
end

#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
#  处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的 内部使用。
#==============================================================================

class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  # ● 获取基本体力最大值
  #--------------------------------------------------------------------------
  def base_maxhp
    if enemy.auto_setup?
      enemy_maxhp = $game_party.avg_hp_max(enemy.level)
      if enemy.type == -1
        enemy_maxhp *= (1 + rand(0))
      else
        enemy_maxhp *= Auto_Enemy::ENEMY_TYPE_HP[enemy.type]
      end
      enemy_maxhp = enemy_maxhp.to_i
      enemy_maxhp += rand(10)
      return enemy_maxhp
    else
      return enemy.maxhp
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取基本魔力最大值
  #--------------------------------------------------------------------------
  def base_maxmp
    if enemy.auto_setup?
      enemy_maxmp = $game_party.avg_mp_max(enemy.level)
      if enemy.type == -1
        enemy_maxmp *= (1 + rand(0))
      else
        enemy_maxmp *= Auto_Enemy::ENEMY_TYPE_MP[enemy.type]
      end
      enemy_maxmp = enemy_maxmp.to_i
      enemy_maxmp += rand(5)
      return enemy_maxmp
    else
      return enemy.maxmp
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取基本攻击力
  #--------------------------------------------------------------------------
  def base_atk
    if enemy.auto_setup?
      enemy_atk = $game_party.avg_atk(enemy.level)
      if enemy.type == -1
        enemy_atk *= (1 + rand(0))
      else
        enemy_atk *= Auto_Enemy::ENEMY_TYPE_ATK[enemy.type]
      end
      enemy_atk = enemy_atk.to_i
      enemy_atk += rand(5)
      return enemy_atk
    else
      return enemy.atk
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取基本防御力
  #--------------------------------------------------------------------------
  def base_def
    if enemy.auto_setup?
      enemy_def = $game_party.avg_def(enemy.level)
      if enemy.type == -1
        enemy_def *= (1 + rand(0))
      else
        enemy_def *= Auto_Enemy::ENEMY_TYPE_DEF[enemy.type]
      end
      enemy_def = enemy_def.to_i
      enemy_def += rand(5)
      return enemy_def
    else
      return enemy.def
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取基本精神力
  #--------------------------------------------------------------------------
  def base_spi
    if enemy.auto_setup?
      enemy_spi = $game_party.avg_spi(enemy.level)
      if enemy.type == -1
        enemy_spi *= (1 + rand(0))
      else
        enemy_spi *= Auto_Enemy::ENEMY_TYPE_SPI[enemy.type]
      end
      enemy_spi = enemy_spi.to_i
      enemy_spi += rand(5)
      return enemy_spi
    else
      return enemy.spi
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取基本敏捷
  #--------------------------------------------------------------------------
  def base_agi
    if enemy.auto_setup?
      enemy_agi = $game_party.avg_agi(enemy.level)
      if enemy.type == -1
        enemy_agi *= (1 + rand(0))
      else
        enemy_agi *= Auto_Enemy::ENEMY_TYPE_AGI[enemy.type]
      end
      enemy_agi = enemy_agi.to_i
      enemy_agi += rand(5)
      return enemy_agi
    else
      return enemy.agi
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取命中率
  #--------------------------------------------------------------------------
  def hit
    if enemy.auto_setup?
      enemy_hit = $game_party.avg_hit
      if enemy.type == -1
        enemy_hit *= (1 + rand(0))
      elsif enemy.type == 6
        enemy_hit = 95
      else
        enemy_hit *= Auto_Enemy::ENEMY_TYPE_HIT[enemy.type]
      end
      return [[enemy_hit.to_i, 95].min, 50].max
    else
      return enemy.hit
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取闪躲率
  #--------------------------------------------------------------------------
  def eva
    if enemy.auto_setup?
      enemy_eva = $game_party.avg_eva
      if enemy.type == -1
        enemy_eva *= (1 + rand(0))
      elsif enemy.type == 6
        enemy_eva = 95
      else
        enemy_eva *= Auto_Enemy::ENEMY_TYPE_EVA[enemy.type]
      end
      return [[enemy_eva.to_i, 95].min, 0].max
    else
      return enemy.eva
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取经验值
  #--------------------------------------------------------------------------
  def exp
    if enemy.auto_setup?
      exp = ($game_party.avg_exp_needed * Auto_Enemy::EXPERIENCE).to_i
      exp =* enemy.type == 6 ? Auto_Enemy::BOSS_EXP : 1
      exp += rand(10)
      return exp
    else
      return enemy.exp
    end
  end  
end

class Game_Interpreter
  def make_enemy_database
    for i in 1...$data_enemies.size
      game_enemy = Game_Enemy.new(1, i)
      if $data_enemies.auto_setup?
        $data_enemies.maxhp      = game_enemy.base_maxhp
        $data_enemies.maxmp      = game_enemy.base_maxmp
        $data_enemies.atk        = game_enemy.base_atk
        $data_enemies.def        = game_enemy.base_def
        $data_enemies.spi        = game_enemy.base_spi
        $data_enemies.agi        = game_enemy.base_agi
        $data_enemies.hit        = game_enemy.hit
        $data_enemies.eva        = game_enemy.eva
        $data_enemies.exp        = game_enemy.exp
        if $lazy_item_setup
          $data_enemies.drop_item1 = game_enemy.drop_item1
          $data_enemies.drop_item2 = game_enemy.drop_item2
        end
      end
    end
    save_data($data_enemies,"Data/Enemies.rvdata") if Auto_Enemy::WRITE_2_DATABASE
  end
end

Lv1.梦旅人

Mr.Gandum

梦石
0
星屑
226
在线时间
2070 小时
注册时间
2007-1-31
帖子
3039

贵宾

2
发表于 2012-7-23 07:25:10 | 只看该作者
没有。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
95
在线时间
440 小时
注册时间
2012-6-5
帖子
96
3
发表于 2012-7-26 01:12:43 | 只看该作者
本帖最后由 紫菜豆腐煲 于 2012-7-26 01:14 编辑

脚本整合里有的,给你搬过来

这是敌人复制角色
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Enemy Levels Add-On: Doppelganger v1.00
  4. # -- Last Updated: 2012.01.23
  5. # -- Level: Normal
  6. # -- Requires: Yanfly Engine Ace - Enemy Levels v1.00+
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-Doppelganger"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.23 - Started Script and Finished.
  15. #
  16. #==============================================================================
  17. # ▼ Introduction
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # This script gives the ability to base an enemy's stats off of a class or, as
  20. # the script title suggests, an actor as a doppelganger. Doppelgangers will
  21. # have the option of copying an actor's name, naming it differently, copying
  22. # their stats, and even going as far as copying their current skills.
  23. #
  24. #==============================================================================
  25. # ▼ Instructions
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # To install this script, open up your script editor and copy/paste this script
  28. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  29. #
  30. # -----------------------------------------------------------------------------
  31. # Actor Notetags - These notetags go in the actors notebox in the database.
  32. # -----------------------------------------------------------------------------
  33. # <doppelganger battler: string>
  34. # This will set the battler used for the current actor to the battler filename
  35. # of string. If no battler is used, doppelgangers will use their default image.
  36. # Doppelganger battlers will give priority to script called battlers, then
  37. # actor doppelganger battlers, then class doppelganger battlers, then default
  38. # enemy battlers.
  39. #
  40. # -----------------------------------------------------------------------------
  41. # Class Notetags - These notetags go in the class notebox in the database.
  42. # -----------------------------------------------------------------------------
  43. # <doppelganger battler: string>
  44. # This will set the battler used for the current class to the battler filename
  45. # of string. If no battler is used, doppelgangers will use their default image.
  46. # Doppelganger battlers will give priority to script called battlers, then
  47. # actor doppelganger battlers, then class doppelganger battlers, then default
  48. # enemy battlers.
  49. #
  50. # -----------------------------------------------------------------------------
  51. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  52. # -----------------------------------------------------------------------------
  53. # <class stats: x>
  54. # This notetag will cause the enemy to take on the base stats of class x at
  55. # that particular level. Note that this tag will only cause the enemy to take
  56. # on the class's stats. Any traits or other custom features related to that
  57. # class will not be factored in. This will take priority over the enemy's
  58. # default stats but will not take priority over a doppelganger actor's stats.
  59. #
  60. # <doppelganger: x>
  61. # This notetag will cause the enemy to take on the base stats and level of
  62. # actor x. Any traits or other custom features related to that actor will not
  63. # be factored in. This will take priority over the enemy's default stats and
  64. # class stats.
  65. #
  66. # <doppelganger member: x>
  67. # This notetag will cause the enemy to take on the base stats and level of the
  68. # party member with index x. Like the doppelganger, any traits or other custom
  69. # features related to that actor will not be factored in. This will take
  70. # priority over the enemy's default stats and class stats. In the event that
  71. # no such member exists in slot x, then the monster will actually not appear
  72. # and not participate in battle. Remember, the first party member's index is 0.
  73. #
  74. # -----------------------------------------------------------------------------
  75. # Script Calls - These commands are used with script calls.
  76. # -----------------------------------------------------------------------------
  77. # $game_actors[actor_id].doppelimage = string
  78. # This will set the specified actor's doppelganger battler image to whatever
  79. # string is as the filename. This can be done mid-game and whatever you set the
  80. # new doppelganger battler image to be will override the actor doppelganger
  81. # and class doppelganger battler images. Set this to nil to nullify it.
  82. #
  83. #==============================================================================
  84. # ▼ Compatibility
  85. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  86. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  87. # it will run with RPG Maker VX without adjusting.
  88. #
  89. # This script requires Yanfly Engine Ace - Enemy Levels v1.00+. Place this
  90. # script under Yanfly Engine Ace - Enemy Levels in the script listing.
  91. #
  92. #==============================================================================

  93. module YEA
  94.   module DOPPELGANGER
  95.    
  96.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  97.     # - Doppelganger Settings -
  98.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  99.     # Adjust the settings here for doppelgangers. Doppelgangers can copy an
  100.     # actor's name, add on a prefix or suffix, and copy the actor's skills.
  101.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  102.     COPY_NAME  = true       # Uses the actor's name for doppelgangers.
  103.     NAME_TEXT  = "Fake %s"  # Name appearance for doppelgangers.
  104.     COPY_SKILL = true       # Uses the actor's skills for doppelgangers.
  105.    
  106.   end # DOPPELGANGER
  107. end # YEA

  108. #==============================================================================
  109. # ▼ Editting anything past this point may potentially result in causing
  110. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  111. # halitosis so edit at your own risk.
  112. #==============================================================================

  113. if $imported["YEA-EnemyLevels"]

  114. module YEA
  115.   module REGEXP
  116.   module BASEITEM
  117.    
  118.     DOPPELIMAGE  = /<(?:DOPPELGANGER_BATTLER|doppelganger battler):[ ](.*)>/i
  119.    
  120.   end # BASEITEM
  121.   module ENEMY
  122.    
  123.     CLASS_STATS  = /<(?:CLASS_STATS|class stats):[ ](\d+)>/i
  124.     DOPPELGANGER = /<(?:DOPPELGANGER|doppelganger):[ ](\d+)>/i
  125.     DOPPELMEMBER = /<(?:DOPPELGANGER_MEMBER|doppelganger member):[ ](\d+)>/i
  126.       
  127.   end # ENEMY
  128.   end # REGEXP
  129. end # YEA

  130. #==============================================================================
  131. # ■ DataManager
  132. #==============================================================================

  133. module DataManager
  134.   
  135.   #--------------------------------------------------------------------------
  136.   # alias method: load_database
  137.   #--------------------------------------------------------------------------
  138.   class <<self; alias load_database_doppel load_database; end
  139.   def self.load_database
  140.     load_database_doppel
  141.     load_notetags_doppel
  142.   end
  143.   
  144.   #--------------------------------------------------------------------------
  145.   # new method: load_notetags_doppel
  146.   #--------------------------------------------------------------------------
  147.   def self.load_notetags_doppel
  148.     groups = [$data_actors, $data_classes, $data_enemies]
  149.     for group in groups
  150.       for obj in group
  151.         next if obj.nil?
  152.         obj.load_notetags_doppel
  153.       end
  154.     end
  155.   end
  156.   
  157. end # DataManager

  158. #==============================================================================
  159. # ■ RPG::BaseItem
  160. #==============================================================================

  161. class RPG::BaseItem
  162.   
  163.   #--------------------------------------------------------------------------
  164.   # public instance variables
  165.   #--------------------------------------------------------------------------
  166.   attr_accessor :doppelimage
  167.   
  168.   #--------------------------------------------------------------------------
  169.   # common cache: load_notetags_doppel
  170.   #--------------------------------------------------------------------------
  171.   def load_notetags_doppel
  172.     @doppelimage = ""
  173.     #---
  174.     self.note.split(/[\r\n]+/).each { |line|
  175.       case line
  176.       #---
  177.       when YEA::REGEXP::BASEITEM::DOPPELIMAGE
  178.         @doppelimage = $1.to_s
  179.       end
  180.     } # self.note.split
  181.     #---
  182.   end
  183.   
  184. end # RPG::BaseItem

  185. #==============================================================================
  186. # ■ RPG::Enemy
  187. #==============================================================================

  188. class RPG::Enemy < RPG::BaseItem
  189.   
  190.   #--------------------------------------------------------------------------
  191.   # public instance variables
  192.   #--------------------------------------------------------------------------
  193.   attr_accessor :class_id
  194.   attr_accessor :doppelganger
  195.   attr_accessor :doppelmember
  196.   
  197.   #--------------------------------------------------------------------------
  198.   # common cache: load_notetags_doppel
  199.   #--------------------------------------------------------------------------
  200.   def load_notetags_doppel
  201.     @class_id = 0
  202.     @doppelganger = 0
  203.     #---
  204.     self.note.split(/[\r\n]+/).each { |line|
  205.       case line
  206.       #---
  207.       when YEA::REGEXP::ENEMY::CLASS_STATS
  208.         @class_id = $1.to_i
  209.       when YEA::REGEXP::ENEMY::DOPPELGANGER
  210.         @doppelganger = $1.to_i
  211.       when YEA::REGEXP::ENEMY::DOPPELMEMBER
  212.         @doppelmember = $1.to_i
  213.       end
  214.     } # self.note.split
  215.     #---
  216.   end
  217.   
  218.   #--------------------------------------------------------------------------
  219.   # new method: actions
  220.   #--------------------------------------------------------------------------
  221.   if YEA::DOPPELGANGER::COPY_SKILL
  222.   def actions
  223.     return @actions if doppelganger_actor.nil?
  224.     list = @actions.dup
  225.     action = RPG::Enemy::Action.new
  226.     action.skill_id = doppelganger_actor.attack_skill_id
  227.     list.push(action)
  228.     for skill in doppelganger_actor.skills
  229.       next unless doppelganger_actor.added_skill_types.include?(skill.stype_id)
  230.       action = RPG::Enemy::Action.new
  231.       action.skill_id = skill.id
  232.       list.push(action)
  233.     end
  234.     return list
  235.   end
  236.   end # YEA::DOPPELGANGER::COPY_SKILL
  237.   
  238.   #--------------------------------------------------------------------------
  239.   # new method: doppelganger_actor
  240.   #--------------------------------------------------------------------------
  241.   def doppelganger_actor
  242.     return doppelmember_actor unless doppelmember_actor.nil?
  243.     return $game_actors[@doppelganger] if @doppelganger > 0
  244.   end
  245.   
  246.   #--------------------------------------------------------------------------
  247.   # new method: doppelmember_actor
  248.   #--------------------------------------------------------------------------
  249.   def doppelmember_actor
  250.     return nil if @doppelmember.nil?
  251.     return $game_party.battle_members[@doppelmember]
  252.   end
  253.   
  254. end # RPG::Enemy

  255. #==============================================================================
  256. # ■ Game_Actor
  257. #==============================================================================

  258. class Game_Actor < Game_Battler
  259.   
  260.   #--------------------------------------------------------------------------
  261.   # public instance variables
  262.   #--------------------------------------------------------------------------
  263.   attr_accessor :doppelimage
  264.   
  265.   #--------------------------------------------------------------------------
  266.   # new method: doppelimage
  267.   #--------------------------------------------------------------------------
  268.   def doppelimage
  269.     return @doppelimage unless @doppelimage.nil?
  270.     return self.actor.doppelimage unless self.actor.doppelimage.nil?
  271.     return self.class.doppelimage unless self.class.doppelimage.nil?
  272.     return nil
  273.   end
  274.   
  275. end # Game_Actor

  276. #==============================================================================
  277. # ■ Game_Enemy
  278. #==============================================================================

  279. class Game_Enemy < Game_Battler
  280.   
  281.   #--------------------------------------------------------------------------
  282.   # alias method: level=
  283.   #--------------------------------------------------------------------------
  284.   alias game_enemy_level_equal_doppel level=
  285.   def level=(value)
  286.     return unless doppelganger.nil?
  287.     game_enemy_level_equal_doppel(value)
  288.   end
  289.   
  290.   #--------------------------------------------------------------------------
  291.   # alias method: set_level_type
  292.   #--------------------------------------------------------------------------
  293.   alias game_enemy_set_level_type_doppel set_level_type
  294.   def set_level_type
  295.     return @level = doppelganger.level unless doppelganger.nil?
  296.     game_enemy_set_level_type_doppel
  297.   end
  298.   
  299.   #--------------------------------------------------------------------------
  300.   # new method: class
  301.   #--------------------------------------------------------------------------
  302.   def class
  303.     return doppelganger.class unless doppelganger.nil?
  304.     return $data_classes[enemy.class_id]
  305.   end
  306.   
  307.   #--------------------------------------------------------------------------
  308.   # new method: doppelganger
  309.   #--------------------------------------------------------------------------
  310.   def doppelganger
  311.     return doppelmember unless doppelmember.nil?
  312.     return $game_actors[enemy.doppelganger]
  313.   end
  314.   
  315.   #--------------------------------------------------------------------------
  316.   # new method: doppelmember
  317.   #--------------------------------------------------------------------------
  318.   def doppelmember
  319.     return nil if enemy.doppelmember.nil?
  320.     return $game_party.battle_members[enemy.doppelmember]
  321.   end
  322.   
  323.   #--------------------------------------------------------------------------
  324.   # alias method: param_base
  325.   #--------------------------------------------------------------------------
  326.   alias game_enemy_param_base_doppel param_base
  327.   def param_base(param_id)
  328.     return actor_base_stats(param_id) unless doppelganger.nil?
  329.     return class_base_stats(param_id) unless self.class.nil?
  330.     return game_enemy_param_base_doppel(param_id)
  331.   end
  332.   
  333.   #--------------------------------------------------------------------------
  334.   # new method: actor_base_stats
  335.   #--------------------------------------------------------------------------
  336.   def actor_base_stats(param_id)
  337.     return game_enemy_param_base_doppel(param_id) if @level.nil?
  338.     return doppelganger.param_base(param_id) + doppelganger.param_plus(param_id)
  339.   end
  340.   
  341.   #--------------------------------------------------------------------------
  342.   # new method: class_base_stats
  343.   #--------------------------------------------------------------------------
  344.   def class_base_stats(param_id)
  345.     return game_enemy_param_base_doppel(param_id) if @level.nil?
  346.     return self.class.params[param_id, @level] if @level <= 99
  347.     if $imported["YEA-AdjustLimits"]
  348.       return self.class.above_lv99_params(param_id, @level)
  349.     end
  350.     return game_enemy_param_base_doppel(param_id)
  351.   end
  352.   
  353.   #--------------------------------------------------------------------------
  354.   # alias method: feature_objects
  355.   #--------------------------------------------------------------------------
  356.   alias game_enemy_feature_objects_doppel feature_objects
  357.   def feature_objects
  358.     result = game_enemy_feature_objects_doppel
  359.     result += [self.class] unless self.class.nil?
  360.     result += [doppelganger.actor] unless doppelganger.nil?
  361.     return result
  362.   end
  363.   
  364.   #--------------------------------------------------------------------------
  365.   # alias method: name
  366.   #--------------------------------------------------------------------------
  367.   alias game_enemy_name_doppel name
  368.   def name
  369.     return doppelganger_name if copy_doppel_name?
  370.     return game_enemy_name_doppel
  371.   end
  372.   
  373.   def doppelganger_name
  374.     fmt = YEA::DOPPELGANGER::NAME_TEXT
  375.     return sprintf(fmt, doppelganger.name)
  376.   end
  377.   
  378.   #--------------------------------------------------------------------------
  379.   # new method: copy_doppel_name?
  380.   #--------------------------------------------------------------------------
  381.   def copy_doppel_name?
  382.     return false if doppelganger.nil?
  383.     return YEA::DOPPELGANGER::COPY_NAME
  384.   end
  385.   
  386.   #--------------------------------------------------------------------------
  387.   # new method: change_doppelganger_battler
  388.   #--------------------------------------------------------------------------
  389.   def change_doppelganger_battler
  390.     return if doppelganger.nil?
  391.     return if doppelganger.doppelimage == ""
  392.     @battler_name = doppelganger.doppelimage
  393.     @battler_hue = 0
  394.   end
  395.   
  396. end # Game_Enemy

  397. #==============================================================================
  398. # ■ Game_Troop
  399. #==============================================================================

  400. class Game_Troop < Game_Unit
  401.   
  402.   #--------------------------------------------------------------------------
  403.   # alias method: init_screen_tone
  404.   #--------------------------------------------------------------------------
  405.   alias game_troop_init_screen_tone_doppel init_screen_tone
  406.   def init_screen_tone
  407.     game_troop_init_screen_tone_doppel
  408.     check_doppelmember
  409.     change_doppelimage
  410.   end
  411.   
  412.   #--------------------------------------------------------------------------
  413.   # new method: check_doppelmember
  414.   #--------------------------------------------------------------------------
  415.   def check_doppelmember
  416.     for member in @enemies
  417.       next if member.enemy.doppelmember.nil?
  418.       @enemies.delete(member) if member.doppelmember.nil?
  419.     end
  420.   end
  421.   
  422.   #--------------------------------------------------------------------------
  423.   # new method: change_doppelimage
  424.   #--------------------------------------------------------------------------
  425.   def change_doppelimage
  426.     for member in @enemies
  427.       next if member.doppelganger.nil?
  428.       member.change_doppelganger_battler
  429.     end
  430.   end
  431.   
  432. end # Game_Troop

  433. end # $imported["YEA-EnemyLevels"]

  434. #==============================================================================
  435. #
  436. # ▼ End of File
  437. #
  438. #==============================================================================
复制代码
的脚本



第二个是敌人等级脚本
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Enemy Levels v1.01
  4. # -- Last Updated: 2012.01.24
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-EnemyLevels"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.24 - Added <hide level> notetag for enemies.
  15. #            - Option to change Party Level function in Action Conditions to
  16. #              enemy level requirements.
  17. # 2011.12.30 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # RPG's with enemies that level up with the party enforces the player to stay
  23. # on their toes the whole time. This is both a good and bad thing as it can
  24. # cause the player to stay alert, but can also cause the player to meet some
  25. # roadblocks. This script will not only provide enemies the ability to level up
  26. # but also allow the script's user to go around these roadblocks using various
  27. # tags to limit or slow down the rate of growth across all enemies.
  28. #
  29. #==============================================================================
  30. # ▼ Instructions
  31. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  32. # To install this script, open up your script editor and copy/paste this script
  33. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  34. #
  35. # -----------------------------------------------------------------------------
  36. # Skill Notetags - These notetags go in the skill notebox in the database.
  37. # -----------------------------------------------------------------------------
  38. # <enemy level: +x>
  39. # <enemy level: -x>
  40. # This causes the enemy to raise or drop x levels depending on the tag used.
  41. # The new level will readjust the enemy's stats (including HP and MP).
  42. #
  43. # <enemy level reset>
  44. # This resets the enemy's level back to the typical range it should be plus or
  45. # minus any level fluctuations it was given. This occurs before enemy level +
  46. # and enemy level - tags.
  47. #
  48. # -----------------------------------------------------------------------------
  49. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  50. # -----------------------------------------------------------------------------
  51. # <hide level>
  52. # This notetag will hide the level of the enemy. If YEA - Enemy Target Info is
  53. # installed, the level will be revealed upon a parameter scan.
  54. #
  55. # <min level: x>
  56. # <max level: x>
  57. # This will adjust the minimum and maximum levels for the enemy. By default,
  58. # the minimum level is 1 and the maximum level is whatever is set in the module
  59. # as MAX_LEVEL.
  60. #
  61. # <set level: x>
  62. # This will set the enemy's level to exactly x. It a sense, this is just the
  63. # usage of both the min and max level tags together as the same value.
  64. #
  65. # <level type: x>
  66. # Choosing a value from 0 to 4, you can adjust the different leveling rulesets
  67. # for the enemy. See the list below.
  68. # Type 0 - Lowest level of all actors that have joined.
  69. # Type 1 - Lowest level in the battle party.
  70. # Type 2 - Average level of the battle party.
  71. # Type 3 - Highest level of the battle party.
  72. # Type 4 - Highest level of all actors that have joined.
  73. #
  74. # <level random: x>
  75. # This will give the level a random flunctuation in either direction. Set this
  76. # value to 0 if you don't wish to use it. Adjust RANDOM_FLUCTUATION inside the
  77. # module to change the default fluctuation value.
  78. #
  79. # <stat: +x per level>
  80. # <stat: -x per level>
  81. # <stat: +x% per level>
  82. # <stat: -x% per level>
  83. # This will raise or lower the stat by x or x% per level (depending on the tag
  84. # used). This will override the default growth settings found inside the module
  85. # hash called DEFAULT_GROWTH. You may replace stat with:
  86. # MAXHP, MAXMP, ATK, DEF, MAT, MDF, AGI, LUK, GOLD, EXP
  87. #
  88. #==============================================================================
  89. # ▼ Compatibility
  90. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  91. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  92. # it will run with RPG Maker VX without adjusting.
  93. #
  94. #==============================================================================

  95. module YEA
  96.   module ENEMY_LEVEL
  97.    
  98.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  99.     # - General Level Settings -
  100.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  101.     # These settings adjust the general level setup for your enemies from the
  102.     # way levels appear in the game to the default maximum level for enemies,
  103.     # to the way their levels are calculated by default, and the random level
  104.     # fluctuation they have. If you want enemies to have different settings,
  105.     # use notetags to change the respective setting.
  106.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  107.     # This is how the level text will appear whenever enemy levels are shown.
  108.     LEVEL_TEXT = "LV%s %s"
  109.    
  110.     # This is the maximum level your enemies can achieve. They cannot go higher
  111.     # no exceptions. Adjust this accordingly to fit your game.
  112.     MAX_LEVEL = 1000
  113.    
  114.     # Default level calculations for your enemies will be adjusted as such.
  115.     # Type 0 - Lowest level of all actors that have joined.
  116.     # Type 1 - Lowest level in the battle party.
  117.     # Type 2 - Average level of the battle party.
  118.     # Type 3 - Highest level of the battle party.
  119.     # Type 4 - Highest level of all actors that have joined.
  120.     DEFAULT_LEVEL_TYPE = 4
  121.    
  122.     # If you want your enemies to have random +/- levels of some degree, change
  123.     # this number to something other than 0. This is the default value.
  124.     RANDOM_FLUCTUATION = 2
  125.    
  126.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  127.     # - Parameter Growth Settings -
  128.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  129.     # Here, you adjust how much stats grow for enemies by default, including
  130.     # the formula used to calculate those stats. If you wish for enemies to
  131.     # have different growth settings, use notetags to change them.
  132.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  133.     # These settings adjust the default growth rates (not the base stat formula)
  134.     # for each stat. These are the values that will exist for each enemy unless
  135.     # defined otherwise by the tags inside their noteboxes.
  136.     DEFAULT_GROWTH ={
  137.     # ParamID => [:param, per%, +set],
  138.             0 => [:maxhp, 0.15,   50],
  139.             1 => [:maxmp, 0.10,   10],
  140.             2 => [  :atk, 0.05,    5],
  141.             3 => [  :def, 0.05,    5],
  142.             4 => [  :mat, 0.05,    5],
  143.             5 => [  :mdf, 0.05,    5],
  144.             6 => [  :agi, 0.05,    5],
  145.             7 => [  :luk, 0.05,    5],
  146.             8 => [ :gold, 0.15,   10],
  147.             9 => [  :exp, 0.05,   10],
  148.     } # Do not remove this.
  149.    
  150.     # The following hash will adjust each of the formulas for each base stat.
  151.     # Adjust them as you see fit but only if you know what you're doing.
  152.     #   base  - The base stat from the enemy database.
  153.     #   per   - Growth rate which has not been yet converted to a percent.
  154.     #   set   - Set growth rate. Modified
  155.     # Default:   "base * (1.00 + (level-1) * per) + (set * (level-1))"
  156.     STAT_FORMULA = "base * (1.00 + (level-1) * per) + (set * (level-1))"
  157.    
  158.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  159.     # - Party Level to Enemy Level Action Conditions -
  160.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  161.     # Setting the below to true will cause the Party Level requirement under
  162.     # Action Conditions in the Action Patterns list to become an Enemy Level
  163.     # requirement. The enemy must be at least the level or else it cannot use
  164.     # the listed action.
  165.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  166.     PARTY_LEVEL_TO_ENEMY_LEVEL = true
  167.    
  168.   end # ENEMY_LEVEL
  169. end # YEA

  170. #==============================================================================
  171. # ▼ Editting anything past this point may potentially result in causing
  172. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  173. # halitosis so edit at your own risk.
  174. #==============================================================================

  175. module YEA
  176.   module REGEXP
  177.   module USABLEITEM
  178.    
  179.     LEVEL_CHANGE = /<(?:ENEMY LEVEL|enemy level):[ ]([\+\-]\d+)>/i
  180.     LEVEL_RESET  = /<(?:ENEMY LEVEL RESET|enemy level reset)>/i
  181.    
  182.   end # USABLEITEM
  183.   module ENEMY
  184.    
  185.     LEVEL_TYPE = /<(?:LEVEL_TYPE|level type):[ ](\d+)>/i
  186.     LEVEL_MIN = /<(?:MIN_LEVEL|min level|minimum level):[ ](\d+)>/i
  187.     LEVEL_MAX = /<(?:MAX_LEVEL|max level|maximum level):[ ](\d+)>/i
  188.     LEVEL_SET = /<(?:SET_LEVEL|set level|permanent level):[ ](\d+)>/i
  189.    
  190.     LEVEL_RAND = /<(?:LEVEL_RANDOM|level random):[ ](\d+)>/i
  191.     GROWTH_PER = /<(.*):[ ]([\+\-]\d+)([%%])[ ](?:PER_LEVEL|per level)>/i
  192.     GROWTH_SET = /<(.*):[ ]([\+\-]\d+)[ ](?:PER_LEVEL|per level)>/i
  193.    
  194.     HIDE_LEVEL = /<(?:HIDE_LEVEL|hide level)>/i
  195.       
  196.   end # ENEMY
  197.   end # REGEXP
  198. end # YEA

  199. #==============================================================================
  200. # ■ Numeric
  201. #==============================================================================

  202. class Numeric
  203.   
  204.   #--------------------------------------------------------------------------
  205.   # new method: group_digits
  206.   #--------------------------------------------------------------------------
  207.   unless $imported["YEA-CoreEngine"]
  208.   def group; return self.to_s; end
  209.   end # $imported["YEA-CoreEngine"]
  210.    
  211. end # Numeric

  212. #==============================================================================
  213. # ■ DataManager
  214. #==============================================================================

  215. module DataManager
  216.   
  217.   #--------------------------------------------------------------------------
  218.   # alias method: load_database
  219.   #--------------------------------------------------------------------------
  220.   class <<self; alias load_database_elv load_database; end
  221.   def self.load_database
  222.     load_database_elv
  223.     load_notetags_elv
  224.   end
  225.   
  226.   #--------------------------------------------------------------------------
  227.   # new method: load_notetags_elv
  228.   #--------------------------------------------------------------------------
  229.   def self.load_notetags_elv
  230.     groups = [$data_enemies, $data_skills, $data_items]
  231.     for group in groups
  232.       for obj in group
  233.         next if obj.nil?
  234.         obj.load_notetags_elv
  235.       end
  236.     end
  237.   end
  238.   
  239. end # DataManager

  240. #==============================================================================
  241. # ■ RPG::UsableItem
  242. #==============================================================================

  243. class RPG::UsableItem < RPG::BaseItem
  244.   
  245.   #--------------------------------------------------------------------------
  246.   # public instance variables
  247.   #--------------------------------------------------------------------------
  248.   attr_accessor :level_change
  249.   attr_accessor :level_reset
  250.   
  251.   #--------------------------------------------------------------------------
  252.   # common cache: load_notetags_elv
  253.   #--------------------------------------------------------------------------
  254.   def load_notetags_elv
  255.     @level_change = 0
  256.     @level_reset = false
  257.     #---
  258.     self.note.split(/[\r\n]+/).each { |line|
  259.       case line
  260.       #---
  261.       when YEA::REGEXP::USABLEITEM::LEVEL_CHANGE
  262.         @level_change = $1.to_i
  263.       when YEA::REGEXP::USABLEITEM::LEVEL_RESET
  264.         @level_reset = true
  265.       end
  266.     } # self.note.split
  267.     #---
  268.   end
  269.   
  270. end # RPG::UsableItem

  271. #==============================================================================
  272. # ■ RPG::Enemy
  273. #==============================================================================

  274. class RPG::Enemy < RPG::BaseItem
  275.   
  276.   #--------------------------------------------------------------------------
  277.   # public instance variables
  278.   #--------------------------------------------------------------------------
  279.   attr_accessor :hide_level
  280.   attr_accessor :level_type
  281.   attr_accessor :level_min
  282.   attr_accessor :level_max
  283.   attr_accessor :level_rand
  284.   attr_accessor :level_growth
  285.   
  286.   #--------------------------------------------------------------------------
  287.   # common cache: load_notetags_elv
  288.   #--------------------------------------------------------------------------
  289.   def load_notetags_elv
  290.     @hide_level = false
  291.     @level_type = YEA::ENEMY_LEVEL::DEFAULT_LEVEL_TYPE
  292.     @level_min = 1
  293.     @level_max = YEA::ENEMY_LEVEL::MAX_LEVEL
  294.     @level_rand = YEA::ENEMY_LEVEL::RANDOM_FLUCTUATION
  295.     @level_growth = YEA::ENEMY_LEVEL::DEFAULT_GROWTH.clone
  296.     #---
  297.     self.note.split(/[\r\n]+/).each { |line|
  298.       case line
  299.       #---
  300.       when YEA::REGEXP::ENEMY::HIDE_LEVEL
  301.         @hide_level = true
  302.       when YEA::REGEXP::ENEMY::LEVEL_TYPE
  303.         @level_type = $1.to_i
  304.       when YEA::REGEXP::ENEMY::LEVEL_MIN
  305.         @level_min = [$1.to_i, 1].max
  306.       when YEA::REGEXP::ENEMY::LEVEL_MAX
  307.         @level_max = [$1.to_i, YEA::ENEMY_LEVEL::MAX_LEVEL].min
  308.       when YEA::REGEXP::ENEMY::LEVEL_SET
  309.         @level_min = [[$1.to_i, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
  310.         @level_max = [[$1.to_i, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
  311.       when YEA::REGEXP::ENEMY::LEVEL_RAND
  312.         @level_rand = $1.to_i
  313.       #---
  314.       when YEA::REGEXP::ENEMY::GROWTH_PER
  315.         case $1.upcase
  316.         when "MAXHP", "MHP", "HP"
  317.           type = 0
  318.         when "MAXMP", "MMP", "MP", "MAXSP", "MSP", "SP"
  319.           type = 1
  320.         when "ATK", "ATTACK"
  321.           type = 2
  322.         when "DEF", "DEFENSE"
  323.           type = 3
  324.         when "MAT", "MAGIC ATTACK", "INT", "INTELLIGENCE", "SPI", "SPIRIT"
  325.           type = 4
  326.         when "MDF", "MAGIC DEFENSE", "RES", "RESISTANCE"
  327.           type = 5
  328.         when "AGI", "AGILITY"
  329.           type = 6
  330.         when "LUK", "LUCK"
  331.           type = 7
  332.         when "GOLD", "MONEY"
  333.           type = 8
  334.         when "EXP", "EXPERIENCE", "XP"
  335.           type = 9
  336.         else; next
  337.         end
  338.         @level_growth[type][1] = $2.to_i * 0.01
  339.       when YEA::REGEXP::ENEMY::GROWTH_SET
  340.         case $1.upcase
  341.         when "MAXHP", "MHP", "HP"
  342.           type = 0
  343.         when "MAXMP", "MMP", "MP", "MAXSP", "MSP", "SP"
  344.           type = 1
  345.         when "ATK", "ATTACK"
  346.           type = 2
  347.         when "DEF", "DEFENSE"
  348.           type = 3
  349.         when "MAT", "MAGIC ATTACK", "INT", "INTELLIGENCE", "SPI", "SPIRIT"
  350.           type = 4
  351.         when "MDF", "MAGIC DEFENSE", "RES", "RESISTANCE"
  352.           type = 5
  353.         when "AGI", "AGILITY"
  354.           type = 6
  355.         when "LUK", "LUCK"
  356.           type = 7
  357.         when "GOLD", "MONEY"
  358.           type = 8
  359.         when "EXP", "EXPERIENCE", "XP"
  360.           type = 9
  361.         else; next
  362.         end
  363.         @level_growth[type][2] = $2.to_i
  364.       end
  365.     } # self.note.split
  366.     #---
  367.   end
  368.   
  369. end # RPG::Enemy

  370. #==============================================================================
  371. # ■ Game_Battler
  372. #==============================================================================

  373. class Game_Battler < Game_BattlerBase
  374.   
  375.   #--------------------------------------------------------------------------
  376.   # alias method: item_user_effect
  377.   #--------------------------------------------------------------------------
  378.   alias game_battler_item_user_effect_elv item_user_effect
  379.   def item_user_effect(user, item)
  380.     game_battler_item_user_effect_elv(user, item)
  381.     apply_level_changes(item) if self.is_a?(Game_Enemy)
  382.   end
  383.   
  384. end # Game_Battler

  385. #==============================================================================
  386. # ■ Game_Enemy
  387. #==============================================================================

  388. class Game_Enemy < Game_Battler
  389.   
  390.   #--------------------------------------------------------------------------
  391.   # alias method: initialize
  392.   #--------------------------------------------------------------------------
  393.   alias game_enemy_initialize_elv initialize
  394.   def initialize(index, enemy_id)
  395.     game_enemy_initialize_elv(index, enemy_id)
  396.     create_init_level
  397.   end
  398.   
  399.   #--------------------------------------------------------------------------
  400.   # new method: level
  401.   #--------------------------------------------------------------------------
  402.   def level
  403.     create_init_level if @level.nil?
  404.     return @level
  405.   end
  406.   
  407.   #--------------------------------------------------------------------------
  408.   # new method: level=
  409.   #--------------------------------------------------------------------------
  410.   def level=(value)
  411.     create_init_level if @level.nil?
  412.     return if @level == value
  413.     hp_rate = self.hp.to_f / self.mhp.to_f
  414.     mp_rate = self.mp.to_f / [self.mmp, 1].max.to_f
  415.     @level = [[value, 1].max, YEA::ENEMY_LEVEL::MAX_LEVEL].min
  416.     self.hp = (self.mhp * hp_rate).to_i
  417.     self.mp = (self.mmp * mp_rate).to_i
  418.   end
  419.   
  420.   #--------------------------------------------------------------------------
  421.   # new method: create_init_level
  422.   #--------------------------------------------------------------------------
  423.   def create_init_level
  424.     set_level_type
  425.     @hp = mhp
  426.     @mp = mmp
  427.   end
  428.   
  429.   #--------------------------------------------------------------------------
  430.   # new method: set_level_type
  431.   #--------------------------------------------------------------------------
  432.   def set_level_type
  433.     @level = $game_party.match_party_level(enemy.level_type)
  434.     @level += rand(enemy.level_rand+1)
  435.     @level -= rand(enemy.level_rand+1)
  436.     @level = [[@level, enemy.level_max].min, enemy.level_min].max
  437.   end
  438.   
  439.   #--------------------------------------------------------------------------
  440.   # alias method: transform
  441.   #--------------------------------------------------------------------------
  442.   alias game_enemy_transform_elv transform
  443.   def transform(enemy_id)
  444.     game_enemy_transform_elv(enemy_id)
  445.     create_init_level
  446.   end
  447.   
  448.   #--------------------------------------------------------------------------
  449.   # new method: apply_level_changes
  450.   #--------------------------------------------------------------------------
  451.   def apply_level_changes(item)
  452.     create_init_level if item.level_reset
  453.     self.level += item.level_change
  454.   end
  455.   
  456.   #--------------------------------------------------------------------------
  457.   # alias method: param_base
  458.   #--------------------------------------------------------------------------
  459.   alias game_enemy_param_base_elv param_base
  460.   def param_base(param_id)
  461.     base = game_enemy_param_base_elv(param_id)
  462.     per = enemy.level_growth[param_id][1]
  463.     set = enemy.level_growth[param_id][2]
  464.     total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
  465.     return total.to_i
  466.   end
  467.   
  468.   #--------------------------------------------------------------------------
  469.   # alias method: exp
  470.   #--------------------------------------------------------------------------
  471.   alias game_enemy_exp_elv exp
  472.   def exp
  473.     base = game_enemy_exp_elv
  474.     per = enemy.level_growth[8][1]
  475.     set = enemy.level_growth[8][2]
  476.     total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
  477.     return total.to_i
  478.   end
  479.   
  480.   #--------------------------------------------------------------------------
  481.   # alias method: gold
  482.   #--------------------------------------------------------------------------
  483.   alias game_enemy_gold_elv gold
  484.   def gold
  485.     base = game_enemy_gold_elv
  486.     per = enemy.level_growth[9][1]
  487.     set = enemy.level_growth[9][2]
  488.     total = eval(YEA::ENEMY_LEVEL::STAT_FORMULA)
  489.     return total.to_i
  490.   end
  491.   
  492.   #--------------------------------------------------------------------------
  493.   # alias method: name
  494.   #--------------------------------------------------------------------------
  495.   alias game_enemy_name_elv name
  496.   def name
  497.     text = game_enemy_name_elv
  498.     if add_level_name?
  499.       fmt = YEA::ENEMY_LEVEL::LEVEL_TEXT
  500.       text = sprintf(fmt, @level.group, text)
  501.     end
  502.     return text
  503.   end
  504.   
  505.   #--------------------------------------------------------------------------
  506.   # new method: add_level_name?
  507.   #--------------------------------------------------------------------------
  508.   def add_level_name?
  509.     if $imported["YEA-EnemyTargetInfo"] && show_info_param?
  510.       return true
  511.     end
  512.     return false if enemy.hide_level
  513.     return true
  514.   end
  515.   
  516.   #--------------------------------------------------------------------------
  517.   # overwrite method: conditions_met_party_level?
  518.   #--------------------------------------------------------------------------
  519.   if YEA::ENEMY_LEVEL::PARTY_LEVEL_TO_ENEMY_LEVEL
  520.   def conditions_met_party_level?(param1, param2)
  521.     return @level >= param1
  522.   end
  523.   end
  524.   
  525. end # Game_Enemy

  526. #==============================================================================
  527. # ■ Game_Party
  528. #==============================================================================

  529. class Game_Party < Game_Unit
  530.   
  531.   #--------------------------------------------------------------------------
  532.   # new method: match_party_level
  533.   #--------------------------------------------------------------------------
  534.   def match_party_level(level_type)
  535.     case level_type
  536.     when 0; return all_lowest_level
  537.     when 1; return lowest_level
  538.     when 2; return average_level
  539.     when 3; return highest_level
  540.     else;   return all_highest_level
  541.     end
  542.   end
  543.   
  544.   #--------------------------------------------------------------------------
  545.   # new method: all_lowest_level
  546.   #--------------------------------------------------------------------------
  547.   def all_lowest_level
  548.     lv = all_members.collect {|actor| actor.level }.min
  549.     return lv
  550.   end
  551.   
  552.   #--------------------------------------------------------------------------
  553.   # new method: lowest_level
  554.   #--------------------------------------------------------------------------
  555.   def lowest_level
  556.     lv = members.collect {|actor| actor.level }.min
  557.     return lv
  558.   end
  559.   
  560.   #--------------------------------------------------------------------------
  561.   # new method: average_level
  562.   #--------------------------------------------------------------------------
  563.   def average_level
  564.     lv = 0
  565.     for member in all_members; lv += member.level; end
  566.     lv /= all_members.size
  567.     return lv
  568.   end
  569.   
  570.   #--------------------------------------------------------------------------
  571.   # overwrite method: highest_level
  572.   #--------------------------------------------------------------------------
  573.   def highest_level
  574.     lv = members.collect {|actor| actor.level }.max
  575.     return lv
  576.   end
  577.   
  578.   #--------------------------------------------------------------------------
  579.   # all method: all_highest_level
  580.   #--------------------------------------------------------------------------
  581.   def all_highest_level
  582.     lv = all_members.collect {|actor| actor.level }.max
  583.     return lv
  584.   end
  585.   
  586. end # Game_Party

  587. #==============================================================================
  588. #
  589. # ▼ End of File
  590. #
  591. #==============================================================================
复制代码
请仔细看说明,并自行翻译

点评

就是脚本合集阿 http://bbs.66rpg.com/thread-225130-1-1.html  发表于 2012-8-1 07:20
可以截一张范例图吗?  发表于 2012-7-31 16:43

评分

参与人数 1星屑 +200 梦石 +2 收起 理由
仲秋启明 + 200 + 2 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
416 小时
注册时间
2012-11-30
帖子
162
4
发表于 2013-11-23 19:51:06 | 只看该作者
麻烦楼主把脚本框起来行吗,好难看,也不容易复制,这边又没颜色——

点评

补充一句 我在学脚本,这几个脚本我拿去研究咯  发表于 2013-11-23 19:52

<object width="630" height="500" align="middle" id="reader" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-44455354000
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-17 06:48

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表