Project1

标题: 提供一个思路,可解决烦躁的数据库设置的一小部分。 [打印本页]

作者: 1243852    时间: 2012-9-25 19:53
标题: 提供一个思路,可解决烦躁的数据库设置的一小部分。
、。之所以只提供思路,是因为这套思路定然需要脚本才能完成,而我根本不会脚本。。。


思路如下:

  我发现大多数人,都很有兴趣去做地图、剧情、事件、系统,但却对制作数据库感到烦躁,我也是其中一个。繁琐的武器设置、技能设置、敌人设置,计算伤害,真的相当让人感觉头大,因为你无法估计,当玩家得到XX武器的时候,他应该是个什么样的等级,遇到什么样的怪。。。怪遇小了,游戏变简单,怪遇大了,游戏太难。


我所提供的思路,可以解决敌人设置的问题。

就是,设置一种敌人成长的系统。他会随着玩家的等级、攻击力、防御力、HP、MP等等数据,进行一个比例性的生长。也就是说,玩家有多厉害,怪物就会在作者预先设置的比例上面,长到多厉害。那么我们就不用考虑怪物的数据了,只需要考虑他的种类就行了。

当然,此系统脚本,可以设置一些特殊类敌人,诸如使用when   return 这种语句来定义,某几个敌人编号。这几个编号,不会受到成长比例的影响,而这几个编号的作用,主要就是用于制作BOSS。
作者: IamI    时间: 2012-9-25 20:04
已采集。考虑嵌入中
作者: yagami    时间: 2012-9-25 20:11
我也这么偷懒的设定的 只要个怪物加个新属性 LV ,数据库里的数据都是成长值 怪物实际能力是成长值*LV 脚本改动很简单的 省不少时间
作者: Password    时间: 2012-9-25 20:14
看到这个我还是老老实实去捣鼓数据库吧
一碰脚本就晕死……
作者: pigsss    时间: 2012-9-25 20:26
老早就有了 ……
不过有想法不错
作者: yagami    时间: 2012-9-25 20:29
  1. module RPG
  2.   class Enemy
  3.      def lv
  4.    return 1 if @name.split(/@/)[1] == nil
  5.    return @name.split(/@/)[1].to_i
  6. end
  7. def name
  8.       return @name.split(/@/)[0]
  9.     end

  10. end
  11. end
复制代码
  1. #==============================================================================
  2. # ■ Game_Enemy
  3. #------------------------------------------------------------------------------
  4. #  处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的
  5. # 内部使用。
  6. #==============================================================================

  7. class Game_Enemy < Game_Battler
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #     troop_id     : 循环 ID
  11.   #     member_index : 循环成员的索引
  12.   #--------------------------------------------------------------------------
  13.   def initialize(troop_id, member_index)
  14.     super()
  15.     @troop_id = troop_id
  16.     @member_index = member_index
  17.     troop = $data_troops[@troop_id]
  18.     @enemy_id = troop.members[@member_index].enemy_id
  19.     enemy = $data_enemies[@enemy_id]
  20.     @battler_name = enemy.battler_name
  21.     @battler_hue = enemy.battler_hue
  22.     @hp = maxhp
  23.     @sp = maxsp
  24.     @hidden = troop.members[@member_index].hidden
  25.     @immortal = troop.members[@member_index].immortal
  26.   end
  27.   
  28.   
  29.   #--------------------------------------------------------------------------
  30.   # ● 获取敌人 ID
  31.   #--------------------------------------------------------------------------
  32.   def id
  33.     return @enemy_id
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 获取索引
  37.   #--------------------------------------------------------------------------
  38.   def index
  39.     return @member_index
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # ● 获取名称
  43.   #--------------------------------------------------------------------------
  44.   def name
  45.     return $data_enemies[@enemy_id].name
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 获取基本 MaxHP
  49.   #--------------------------------------------------------------------------
  50.   def base_maxhp
  51.     return $data_enemies[@enemy_id].maxhp * $data_enemies[@enemy_id].lv
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 获取基本 MaxSP
  55.   #--------------------------------------------------------------------------
  56.   def base_maxsp
  57.     return $data_enemies[@enemy_id].maxsp * $data_enemies[@enemy_id].lv
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● 获取基本力量
  61.   #--------------------------------------------------------------------------
  62.   def base_str
  63.     return $data_enemies[@enemy_id].str * $data_enemies[@enemy_id].lv
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # ● 获取基本灵巧
  67.   #--------------------------------------------------------------------------
  68.   def base_dex
  69.     return $data_enemies[@enemy_id].dex * $data_enemies[@enemy_id].lv
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # ● 获取基本速度
  73.   #--------------------------------------------------------------------------
  74.   def base_agi
  75.     return $data_enemies[@enemy_id].agi * $data_enemies[@enemy_id].lv
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● 获取基本魔力
  79.   #--------------------------------------------------------------------------
  80.   def base_int
  81.     return $data_enemies[@enemy_id].int * $data_enemies[@enemy_id].lv
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # ● 获取基本攻击力
  85.   #--------------------------------------------------------------------------
  86.   def base_atk
  87.     return $data_enemies[@enemy_id].atk * $data_enemies[@enemy_id].lv
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # ● 获取基本物理防御
  91.   #--------------------------------------------------------------------------
  92.   def base_pdef
  93.     return $data_enemies[@enemy_id].pdef * $data_enemies[@enemy_id].lv
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # ● 获取基本魔法防御
  97.   #--------------------------------------------------------------------------
  98.   def base_mdef
  99.     return $data_enemies[@enemy_id].mdef * $data_enemies[@enemy_id].lv
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # ● 获取基本回避修正
  103.   #--------------------------------------------------------------------------
  104.   def base_eva
  105.     return $data_enemies[@enemy_id].eva
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # ● 普通攻击 获取攻击方动画 ID
  109.   #--------------------------------------------------------------------------
  110.   def animation1_id
  111.     return $data_enemies[@enemy_id].animation1_id
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 普通攻击 获取对像方动画 ID
  115.   #--------------------------------------------------------------------------
  116.   def animation2_id
  117.     return $data_enemies[@enemy_id].animation2_id
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 获取属性修正值
  121.   #     element_id : 属性 ID
  122.   #--------------------------------------------------------------------------
  123.   def element_rate(element_id)
  124.     # 获取对应属性有效度的数值
  125.     table = [0,200,150,100,50,0,-100]
  126.     result = table[$data_enemies[@enemy_id].element_ranks[element_id]]
  127.     # 状态能防御本属性的情况下效果减半
  128.     for i in @states
  129.       if $data_states[i].guard_element_set.include?(element_id)
  130.         result /= 2
  131.       end
  132.     end
  133.     # 过程结束
  134.     return result
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 获取属性有效度
  138.   #--------------------------------------------------------------------------
  139.   def state_ranks
  140.     return $data_enemies[@enemy_id].state_ranks
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 属性防御判定
  144.   #     state_id : 状态 ID
  145.   #--------------------------------------------------------------------------
  146.   def state_guard?(state_id)
  147.     return false
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 获取普通攻击属性
  151.   #--------------------------------------------------------------------------
  152.   def element_set
  153.     return []
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 获取普通攻击的状态变化 (+)
  157.   #--------------------------------------------------------------------------
  158.   def plus_state_set
  159.     return []
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● 获取普通攻击的状态变化 (-)
  163.   #--------------------------------------------------------------------------
  164.   def minus_state_set
  165.     return []
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # ● 获取行动
  169.   #--------------------------------------------------------------------------
  170.   def actions
  171.     return $data_enemies[@enemy_id].actions
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # ● 获取 EXP
  175.   #--------------------------------------------------------------------------
  176.   def exp
  177.     return $data_enemies[@enemy_id].exp
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 获取金钱
  181.   #--------------------------------------------------------------------------
  182.   def gold
  183.     return $data_enemies[@enemy_id].gold
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● 获取物品 ID
  187.   #--------------------------------------------------------------------------
  188.   def item_id
  189.     return $data_enemies[@enemy_id].item_id
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● 获取武器 ID
  193.   #--------------------------------------------------------------------------
  194.   def weapon_id
  195.     return $data_enemies[@enemy_id].weapon_id
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 获取防具 ID
  199.   #--------------------------------------------------------------------------
  200.   def armor_id
  201.     return $data_enemies[@enemy_id].armor_id
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 获取宝物出现率
  205.   #--------------------------------------------------------------------------
  206.   def treasure_prob
  207.     return $data_enemies[@enemy_id].treasure_prob
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● 取得战斗画面 X 坐标
  211.   #--------------------------------------------------------------------------
  212.   def screen_x
  213.     return $data_troops[@troop_id].members[@member_index].x
  214.   end
  215.   #--------------------------------------------------------------------------
  216.   # ● 取得战斗画面 Y 坐标
  217.   #--------------------------------------------------------------------------
  218.   def screen_y
  219.     return $data_troops[@troop_id].members[@member_index].y
  220.   end
  221.   #--------------------------------------------------------------------------
  222.   # ● 取得战斗画面 Z 坐标
  223.   #--------------------------------------------------------------------------
  224.   def screen_z
  225.     return screen_y
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ● 逃跑
  229.   #--------------------------------------------------------------------------
  230.   def escape
  231.     # 设置隐藏标志
  232.     @hidden = true
  233.     # 清除当前行动
  234.     self.current_action.clear
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ● 变身
  238.   #     enemy_id : 变身为的敌人 ID
  239.   #--------------------------------------------------------------------------
  240.   def transform(enemy_id)
  241.     # 更改敌人 ID
  242.     @enemy_id = enemy_id
  243.     # 更改战斗图形
  244.     @battler_name = $data_enemies[@enemy_id].battler_name
  245.     @battler_hue = $data_enemies[@enemy_id].battler_hue
  246.     # 再生成行动
  247.     make_action
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 生成行动
  251.   #--------------------------------------------------------------------------
  252.   def make_action
  253.     # 清除当前行动
  254.     self.current_action.clear
  255.     # 无法行动的情况
  256.     unless self.movable?
  257.       # 过程结束
  258.       return
  259.     end
  260.     # 抽取现在有效的行动
  261.     available_actions = []
  262.     rating_max = 0
  263.     for action in self.actions
  264.       # 确认回合条件
  265.       n = $game_temp.battle_turn
  266.       a = action.condition_turn_a
  267.       b = action.condition_turn_b
  268.       if (b == 0 and n != a) or
  269.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  270.         next
  271.       end
  272.       # 确认 HP 条件
  273.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  274.         next
  275.       end
  276.       # 确认等级条件
  277.       if $game_party.max_level < action.condition_level
  278.         next
  279.       end
  280.       # 确认开关条件
  281.       switch_id = action.condition_switch_id
  282.       if switch_id > 0 and $game_switches[switch_id] == false
  283.         next
  284.       end
  285.       # 符合条件 : 添加本行动
  286.       available_actions.push(action)
  287.       if action.rating > rating_max
  288.         rating_max = action.rating
  289.       end
  290.     end
  291.     # 最大概率值作为 3 合计计算(0 除外)
  292.     ratings_total = 0
  293.     for action in available_actions
  294.       if action.rating > rating_max - 3
  295.         ratings_total += action.rating - (rating_max - 3)
  296.       end
  297.     end
  298.     # 概率合计不为 0 的情况下
  299.     if ratings_total > 0
  300.       # 生成随机数
  301.       value = rand(ratings_total)
  302.       # 设置对应生成随机数的当前行动
  303.       for action in available_actions
  304.         if action.rating > rating_max - 3
  305.           if value < action.rating - (rating_max - 3)
  306.             self.current_action.kind = action.kind
  307.             self.current_action.basic = action.basic
  308.             self.current_action.skill_id = action.skill_id
  309.             self.current_action.decide_random_target_for_enemy
  310.             return
  311.           else
  312.             value -= action.rating - (rating_max - 3)
  313.           end
  314.         end
  315.       end
  316.     end
  317.   end
  318. end
复制代码

作者: 晴兰    时间: 2012-9-25 20:31
提示: 作者被禁止或删除 内容自动屏蔽
作者: feizhaodan    时间: 2012-9-25 20:49
我会说我很喜欢搞弄数据库么?
你只需要一个大致的数字即可。不用考虑太高的,也不用考虑太低的。实际上我都是这么想,然后平衡一般都没问题。
作者: 布里蓝    时间: 2012-9-25 21:00
我一般是先考虑打到这个阶段主角有几级,然后设个几级,再慢慢测试
作者: 爱尔伯塔    时间: 2012-9-25 21:14
设置数据库确实让人头疼...
作者: 精灵使者    时间: 2012-9-25 23:31
精灵对于这种东西的测试在后期的剧情测试中进行的……
模拟真·正的玩家的每一分动作……发生的。
作者: evermilk    时间: 2012-9-25 23:43
用心的话,你会发现数据库非常有趣
作者: Tink    时间: 2012-9-25 23:45
唔 把数据库当玩具玩的撸过
话说 谁给写个VA版的脚本?←伸手可耻 当我没说……
作者: yoyu1989    时间: 2012-9-25 23:58
48。敌人等级系统(来自Yanfly Engine Ace)
    使用后可以使敌人也拥有等级,增加敌人能力值,具体成长值可以在脚本中设置。
适用游戏:角色扮演游戏且角色能力值比较高
[原创发布] 【VA】超级脚本整合+说明(有时间我会更新的
这些脚本我都一个个认真的看了~所以知道这个有~是VA的哦~还有商店的自动定义的那个脚本也很好用~
作者: 疯狂异形    时间: 2012-9-26 05:30
本帖最后由 疯狂异形 于 2012-9-25 21:31 编辑


我这边已经有EXCEL成品了,而且很平衡。
嗯……但是……
这是为Y君造的,所以不外传嗯
作者: yoyu1989    时间: 2012-9-26 12:17
本帖最后由 yoyu1989 于 2012-9-26 12:29 编辑
yoyu1989 发表于 2012-9-25 23:58
48。敌人等级系统(来自Yanfly Engine Ace)
    使用后可以使敌人也拥有等级,增加敌人能力值,具体成长值 ...


?????我这的那脚本是全英文的啊~我用谷歌翻译了看下,依然没肿么懂~不过上面有个注释我感觉可能是整个脚本的开关~你要不要???
我给你的也是英文的~用谷歌翻译依然没看懂~

那脚本就是那个整合里的~我看了下他的怪物设定什么也没有设~就自动用上了~

然后脚本的最上面有个好像是开关的东西~
好吧我对于脚本也只是给我就用那种的~改脚本我不会~
敌人等级~
  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 = 9999
  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 = 2
  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,   10],
  139.             1 => [:maxmp, 0.10,   2],
  140.             2 => [  :atk, 0.05,    1],
  141.             3 => [  :def, 0.05,    1],
  142.             4 => [  :mat, 0.05,    1],
  143.             5 => [  :mdf, 0.05,    1],
  144.             6 => [  :agi, 0.05,    1],
  145.             7 => [  :luk, 0.05,    1],
  146.             8 => [ :gold, 0.15,   2],
  147.             9 => [  :exp, 0.05,   2],
  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. #==============================================================================
复制代码
敌人成长~好像可以和等级配合用~
  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. #==============================================================================
复制代码

作者: 天使喝可乐    时间: 2012-9-26 20:28
怪物属性完全按玩家属性比例成长?那请问升级有什么意义?
作者: harinlen    时间: 2012-9-26 20:36
表示私还是很享受数据库这种东西的,看着那么多的数字觉得很有规律啊~




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1