Project1

标题: ISA - 角色变化敌人 - Actor Change Enemy - for XP [打印本页]

作者: 忧雪の伤    时间: 2011-4-3 13:52
标题: ISA - 角色变化敌人 - Actor Change Enemy - for XP
本帖最后由 忧雪の伤 于 2011-4-4 12:07 编辑
  1. #______________________________________________________________________________
  2. # * 此脚本归66RPG - Idiot Script Association(ISA)所有,谢绝任何形式转载。
  3. #______________________________________________________________________________

  4. #==============================================================================
  5. # ■ 角色变化敌人 - Actor Change Enemy - for XP
  6. #------------------------------------------------------------------------------
  7. #   遵守协议:66RPG - Idiot Script Association(ISA)
  8. #   当前版本:1.0.0.0
  9. #------------------------------------------------------------------------------
  10. #   更新日记:忧雪の伤(2011.4.3)
  11. #             - 初始化
  12. #==============================================================================

  13. #--------------------------------------------------------------------------
  14. # ● 资料记录
  15. #--------------------------------------------------------------------------

  16. module ISA
  17.    Use["角色变化敌人"] = [true, "1.0.0.0"]
  18.    System["角色变化敌人"] = {}
  19. end

  20. #--------------------------------------------------------------------------
  21. # ● 设定部分
  22. #--------------------------------------------------------------------------

  23. module ISA
  24.   System["角色变化敌人"]["等级显示"] = true
  25.   System["角色变化敌人"]["名称改变"] = true
  26.   System["角色变化敌人"]["图形改变"] = true
  27. end

  28. #==============================================================================
  29. # ■ RPG
  30. #------------------------------------------------------------------------------
  31. #  集合了 RPGXP 数据结构等的模块。
  32. #==============================================================================

  33. module RPG
  34.   #--------------------------------------------------------------------------
  35.   # ● 敌人的数据类。
  36.   #--------------------------------------------------------------------------  
  37.   class Enemy
  38.     def name
  39.       return @name.split(/change/)[0]
  40.     end
  41.     def change_id
  42.       return @name.split(/change/)[1].to_i
  43.     end
  44.   end
  45. end

  46. #==============================================================================
  47. # ■ Game_Enemy
  48. #------------------------------------------------------------------------------
  49. #  处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的
  50. # 内部使用。
  51. #==============================================================================

  52. class Game_Enemy < Game_Battler
  53.   include ISA
  54.   #--------------------------------------------------------------------------
  55.   # ● 定义实例变量
  56.   #--------------------------------------------------------------------------
  57.   attr_reader :level  
  58.   attr_reader :change_id
  59.   #--------------------------------------------------------------------------
  60.   # ● 初始化对像
  61.   #     troop_id     : 循环 ID
  62.   #     member_index : 循环成员的索引
  63.   #--------------------------------------------------------------------------
  64.   alias :actor_change_enemy_initialize :initialize unless method_defined? :actor_change_enemy_initialize
  65.   def initialize(troop_id, member_index)
  66.     enemy_id = $data_troops[troop_id].members[member_index].enemy_id
  67.     @change_id = $data_enemies[enemy_id].change_id
  68.     level_list = 0
  69.     $game_party.actors.each do |actor|
  70.       level_list += actor.level
  71.     end
  72.     @level = level_list / $game_party.actors.size + rand(2) - rand(2)
  73.     @level = 99 if @level > 99
  74.     actor_change_enemy_initialize(troop_id, member_index)
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 获取战斗者 文件名
  78.   #--------------------------------------------------------------------------
  79.   def battler_name
  80.     case System["角色变化敌人"]["图形改变"]
  81.     when true
  82.       return (@change_id != 0 ? $data_actors[@change_id].battler_name : @battler_name)
  83.     when false
  84.       return @battler_name
  85.     end
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 获取名称
  89.   #--------------------------------------------------------------------------
  90.   alias :actor_change_enemy_name :name unless method_defined? :actor_change_enemy_name
  91.   def name
  92.     level = System["角色变化敌人"]["等级显示"] ? " Lv" + @level.to_s : ""
  93.     case System["角色变化敌人"]["名称改变"]
  94.     when true
  95.       return (@change_id != 0 ? $data_actors[@change_id].name : actor_change_enemy_name) + level
  96.     else
  97.       return actor_change_enemy_name + level
  98.     end
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ● 获取基本 MaxHP
  102.   #--------------------------------------------------------------------------
  103.   alias :actor_change_enemy_base_maxhp :base_maxhp unless method_defined? :actor_change_enemy_base_maxhp
  104.   def base_maxhp
  105.     if @change_id != 0
  106.       n = change_parameters(@change_id, 0, @level)
  107.     else
  108.       n = (actor_change_enemy_base_maxhp * wave).to_i
  109.     end
  110.     return n
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ● 获取基本 MaxSP
  114.   #--------------------------------------------------------------------------
  115.   alias :actor_change_enemy_base_maxsp :base_maxsp unless method_defined? :actor_change_enemy_base_maxsp
  116.   def base_maxsp
  117.     if @change_id != 0
  118.       n = change_parameters(@change_id, 1, @level)
  119.     else
  120.       n = (actor_change_enemy_base_maxsp * wave).to_i
  121.     end
  122.     return n
  123.   end
  124.   #--------------------------------------------------------------------------
  125.   # ● 获取基本力量
  126.   #--------------------------------------------------------------------------
  127.   alias :actor_change_enemy_base_str :base_str unless method_defined? :actor_change_enemy_base_str
  128.   def base_str
  129.     if @change_id != 0
  130.       n = change_parameters(@change_id, 2, @level)
  131.     else
  132.       n = (actor_change_enemy_base_str * wave).to_i
  133.     end
  134.     return n
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 获取基本灵巧
  138.   #--------------------------------------------------------------------------
  139.   alias :actor_change_enemy_base_dex :base_dex unless method_defined? :actor_change_enemy_base_dex
  140.   def base_dex
  141.     if @change_id != 0
  142.       n = change_parameters(@change_id, 3, @level)
  143.     else
  144.       n = (actor_change_enemy_base_dex * wave).to_i
  145.     end
  146.     return n
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● 获取基本速度
  150.   #--------------------------------------------------------------------------
  151.   alias :actor_change_enemy_base_agi :base_agi unless method_defined? :actor_change_enemy_base_agi
  152.   def base_agi
  153.     if @change_id != 0
  154.       n = change_parameters(@change_id, 4, @level)
  155.     else
  156.       n = (actor_change_enemy_base_agi * wave).to_i
  157.     end
  158.     return n
  159.   end
  160.   #--------------------------------------------------------------------------
  161.   # ● 获取基本魔力
  162.   #--------------------------------------------------------------------------
  163.   alias :actor_change_enemy_base_int :base_int unless method_defined? :actor_change_enemy_base_int
  164.   def base_int
  165.     if @change_id != 0
  166.       n = change_parameters(@change_id, 5, @level)
  167.     else
  168.       n = (actor_change_enemy_base_int * wave).to_i
  169.     end
  170.     return n
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 获取基本攻击力
  174.   #--------------------------------------------------------------------------
  175.   alias :actor_change_enemy_base_atk :base_atk unless method_defined? :actor_change_enemy_base_atk
  176.   def base_atk
  177.     return (actor_change_enemy_base_atk * wave).to_i
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 获取基本物理防御
  181.   #--------------------------------------------------------------------------
  182.   alias :actor_change_enemy_base_pdef :base_pdef unless method_defined? :actor_change_enemy_base_pdef
  183.   def base_pdef
  184.     return (actor_change_enemy_base_pdef * wave).to_i
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 获取基本魔法防御
  188.   #--------------------------------------------------------------------------
  189.   alias :actor_change_enemy_base_mdef :base_mdef unless method_defined? :actor_change_enemy_base_mdef
  190.   def base_mdef
  191.     return (actor_change_enemy_base_mdef * wave).to_i
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● 获取金钱
  195.   #--------------------------------------------------------------------------
  196.   alias :actor_change_enemy_gold :gold unless method_defined? :actor_change_enemy_gold
  197.   def gold
  198.     return (actor_change_enemy_gold * wave).to_i
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● 获取浮动
  202.   #--------------------------------------------------------------------------
  203.   def wave
  204.     return 1 + 0.05 * (@level - 1)
  205.   end
  206.   #--------------------------------------------------------------------------
  207.   # ● 获取变化参数
  208.   #     change_id     : 变化 ID
  209.   #     kind          : 种类
  210.   #     level         : 等级
  211.   #--------------------------------------------------------------------------  
  212.   def change_parameters(change_id, kind, level = 1)
  213.     return $data_actors[change_id].parameters[kind, level]
  214.   end
  215. end
复制代码


两大功能 -  ①附带敌人能力随角色等级变化,并存在敌人的等级 ②可以让敌人变身角色


敌人变身角色使用方法 - 在数据库敌人名字后面加上change id。id为想要变身的角色id。




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