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

Project1

 找回密码
 注册会员
搜索
查看: 15019|回复: 21

[RMVX发布] 仿传说式称号系统

[复制链接]

Lv1.梦旅人

Mr.Gandum

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

贵宾

发表于 2011-9-27 20:33:38 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 feizhaodan 于 2011-12-16 21:56 编辑

来啦!我的第一个大型脚本。(已经荣幸的超过1000
先放脚本
  1. #============================================================================
  2. # ☆ 仿传说称号系统。
  3. #    由feizhaodan制作。
  4. #    发布于66RPG
  5. #    http://rpg.blue/
  6. #    版本号: 1.2.3
  7. #    添加内容:
  8. #    1.2.3
  9. #     根据皮卡星的建议,增大装备称号确认窗口的Z值并添加$imported
  10. #    1.2.2
  11. #     1.在升级时重新计算百分比增加的属性量。
  12. #     2.在失去称号时若失去的是当前装备,则将称号ID改回默认,并重设属性。
  13. #     3.增加新方法:refresh_appellation。
  14. #    1.2.1
  15. #     修正qwrffdtqfsd 提出的在满HPMP状态下降低HPMP上限会使
  16. #     HPMP超过上限。
  17. #    1.2.0
  18. #     修正若称号说明超过1行,显示不完整。
  19. #    1.1.0
  20. #     增加从状态画面进入各角色的称号装备界面的功能。
  21. #    2011/10/22
  22. #    转载时请连同这里一起转
  23. #============================================================================
  24. #==============================================================================
  25. # ■ Kien::Appellation
  26. #------------------------------------------------------------------------------
  27. #  称号系统。(新模块)(设置内容)
  28. #==============================================================================
  29. module Kien
  30. module Appellation
  31.   
  32.   
  33.   # 不要该这里。
  34.   APPELLATION = []
  35.   
  36.   # 从这里开始设置。
  37.   # 先在这里按例子添加。
  38.   # 格式:
  39.   # APPELLATION[actor_id] = []
  40.   # 在actor_id内填入你的角色ID。把所有你的游戏里的角色都添加一次。
  41.   APPELLATION[1] =[]
  42.   
  43.   # 这里开始一个一个设置。
  44.   # 格式: APPELLATION[actor_id][id] = ["STn[%]|STn[%]", "name", "str"]
  45.   # actor_id填入要设置的角色ID
  46.   # id填入要设置的称号ID。0为预设。
  47.   # ["ST=n|ST=n", "str"]
  48.   # ST表示装备此称号时增加的属性(ATK,DEF,AGI,SPI,HP,SP,EXP,GOLD)
  49.   # 用"|"隔开。可以填写多个。
  50.   # n表示增加量,%可填可不填,填的场合为百分比,不填为那个数量。可以是负数。
  51.   # 其中EXP和GOLD表示获取时增加的量,固定为%。
  52.   # name表示这个称号的名字
  53.   # str表示这个称号的说明。
  54.   # 三个内容的""要留着。
  55.   # 例:
  56.   # 一个没有属性加成的预设称号
  57.   APPELLATION[1][0] = ["", "见习剑士", "还在修炼中的剑士"]
  58.   
  59.   # 一个增加5点HP的一号称号
  60.   APPELLATION[1][1] = ["HP5", "强壮", "表示你拥有强壮体制的称号"]
  61.   
  62.   # 一个增加10点ATK,5点DEF的称号
  63.   APPELLATION[1][2] = ["ATK10|DEF5", "剑士", "已经完成修炼的剑士"]
  64.   
  65.   # 一个将所有属性乘10倍的称号。
  66.   APPELLATION[1][3] = ["HP1000%|MP1000%|ATK1000%|DEF1000%|SPI1000%|AGI1000%", "挑战者", "给敢于挑战未知的人的称号。"]

  67.   # 选项添加在哪,
  68.   # 1为菜单,2为状态窗口内,0为不使用。
  69.   ADD_APPELLATION_COMMAND = 2
  70.   
  71.   # 选项名称。
  72.   APPELLATION_COMMANDNAME = "称号"
  73.   
  74.   # 称号属性名
  75.   APPELLATION_NAME = "称号"
  76.   
  77.   # 未开放称号名
  78.   UNENABLE_NAME = "-------"
  79. end
  80. end

  81. #★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
  82. # 已下为脚本。 不会编脚本的修改之前请备份。
  83. #★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼

  84. $imported = {} if $imported == nil
  85. $imported["Tales_Appellation"] = true

  86. module Kien
  87. module Regexp
  88.   module Appellation
  89.     # 称号附加属性判定
  90.     STATUS = /(HP|MP|ATK|DEF|SPI|AGI|EXP|GOLD)?([\+\-]?\d+)([%])?/i
  91.   end # Appellation
  92. end # Regexp
  93. end # Kien

  94. module Kien::Appellation
  95.   
  96.   APPE_INFO = Struct.new("Appe_Info", :param, :name, :description, :enable)
  97.   
  98.   module_function
  99.   #--------------------------------------------------------------------------
  100.   # ● 获取称号属性
  101.   #     actor_id : 角色 ID
  102.   #     id       : 称号 ID
  103.   #--------------------------------------------------------------------------
  104.   def got_appe_param(actor_id, id)
  105.     param = []
  106.     APPELLATION[actor_id][id][0].split(/\|/).each{ |str|
  107.     case str
  108.     when Kien::Regexp::Appellation::STATUS
  109.       param.push [$1, $2.to_i, $3]
  110.     end
  111.     }
  112.     return param
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 将称号属性构建体化
  116.   #     actor_id : 角色 ID
  117.   #--------------------------------------------------------------------------
  118.   def construct_appe_data(actor_id)
  119.     appe = []
  120.     i = 0
  121.     APPELLATION[actor_id].each { |v|
  122.     info = APPE_INFO.new
  123.     info.param = got_appe_param(actor_id, i)
  124.     info.name = v[1]
  125.     info.description = v[2]
  126.     info.enable = (i == 0)
  127.     appe[i] = info
  128.     i += 1
  129.     }
  130.     return appe
  131.   end
  132. end # Kien
  133. module Kien
  134.   module Command
  135.     module_function
  136.     def get_appellation(actor_id, id)
  137.       $game_actors[actor_id].get_appellation(id)
  138.       return true
  139.     end
  140.    
  141.     def lose_appellation(actor_id, id)
  142.       $game_actors[actor_id].lose_appellation(id)
  143.       return true
  144.     end
  145.    
  146.     def call_equip_appellation(actor_index = 1)
  147.       $scene = Scene_Appellation.new(
  148.           actor_index,
  149.           0,
  150.           1)
  151.       return true
  152.     end
  153.    
  154.     def have_appellation(actor_id, id, sid = 0)
  155.       $game_switches[sid] = $game_actors[actor_id].appellation_list[id].enable
  156.       return $game_actors[actor_id].appellation_list[id].enable
  157.     end
  158.    
  159.     def equip_appellation(actor_id, id, sid = 0)
  160.       $game_switches[sid] = ($game_actors[actor_id].appellation_id == id)
  161.       return ($game_actors[actor_id].appellation_id == id)
  162.     end

  163.     def have_howmany_appellation(actor_id, vid = 0)
  164.       n = 0
  165.       for appe in $game_actors[actor_id].appellation_list
  166.         if appe.enable == true
  167.           n += 1
  168.         else
  169.           next
  170.         end
  171.       end
  172.       $game_variables[vid] = n
  173.       return n
  174.     end
  175.   end
  176. end
  177. #==============================================================================
  178. # ■ Game_Interpreter
  179. #------------------------------------------------------------------------------
  180. #  执行事件命令的解释器。本类在 Game_Map 类、Game_Troop 类、与
  181. # Game_Event 类的内部使用。
  182. #==============================================================================

  183. class Game_Interpreter
  184. include Kien::Command
  185. end

  186. #==============================================================================
  187. # ■ Vocab
  188. #------------------------------------------------------------------------------
  189. #  定义了用语和信息。将部分资料定义为常量。用语部分来自于$data_system。
  190. #==============================================================================

  191. module Vocab
  192.   def self.appellation
  193.     return Kien::Appellation::APPELLATION_NAME
  194.   end
  195.   
  196.   def self.appellation_command_name
  197.     return Kien::Appellation::APPELLATION_COMMANDNAME
  198.   end
  199. end
  200. #★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
  201. # 华丽的分割线
  202. #★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼

  203. #==============================================================================
  204. # ■ Game_Actor
  205. #------------------------------------------------------------------------------
  206. #  处理角色的类。本类在 Game_Actors 类 ($game_actors) 的内部使用、
  207. # Game_Party 类请参考 ($game_party) 。
  208. #==============================================================================

  209. class Game_Actor < Game_Battler
  210.   
  211.     APPE_INFO = Struct.new("Appe_Info", :param, :name, :description, :enable)
  212.   alias appellation_setup setup
  213.   #--------------------------------------------------------------------------
  214.   # ● 定义实例变量
  215.   #--------------------------------------------------------------------------
  216.   attr_accessor :appellation_id
  217.   attr_reader   :appe_gold
  218.   #--------------------------------------------------------------------------
  219.   # ● 设置
  220.   #     actor_id : 角色 ID
  221.   #--------------------------------------------------------------------------
  222.   def setup(actor_id)
  223.     @appe_hp = 0
  224.     @appe_mp = 0
  225.     @appe_atk = 0
  226.     @appe_def = 0
  227.     @appe_spi = 0
  228.     @appe_agi = 0
  229.     @appe_gold = 0
  230.     @appe_exp = 0
  231.     appellation_setup(actor_id)
  232.     @appellation_list = Kien::Appellation.construct_appe_data(actor_id)
  233.     @appellation_id = 0
  234.     create_appe_param
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ● 获取称号列表
  238.   #--------------------------------------------------------------------------
  239.   def appellation_list
  240.     return @appellation_list
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # ● 获取称号内容
  244.   #--------------------------------------------------------------------------
  245.   def appellation
  246.     return @appellation_list[@appellation_id]
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ● 获取新称号
  250.   #--------------------------------------------------------------------------
  251.   def get_appellation(id)
  252.     @appellation_list[id].enable = true
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● 失去称号
  256.   #--------------------------------------------------------------------------
  257.   def lose_appellation(id)
  258.     return if id == 0
  259.     @appellation_list[id].enable = false
  260.     if @appellation_id == id
  261.       @appllation_id = 0
  262.       refresh_appellation
  263.     end
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # ● 更新称号
  267.   #--------------------------------------------------------------------------
  268.   def refresh_appellation
  269.     create_appe_param
  270.     @mp = [@mp, self.maxmp].min
  271.     @hp = [@hp, self.maxhp].min
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● 更换称号
  275.   #--------------------------------------------------------------------------
  276.   def change_appellation(appe_id)
  277.     @appellation_id = appe_id
  278.     refresh_appellation
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ● 获取称号内容
  282.   #--------------------------------------------------------------------------
  283.   def create_appe_param
  284.     @appe_hp = 0
  285.     @appe_mp = 0
  286.     @appe_atk = 0
  287.     @appe_def = 0
  288.     @appe_spi = 0
  289.     @appe_agi = 0
  290.     @appe_gold = 0
  291.     @appe_exp = 0
  292.     if appellation.param.empty?
  293.     else
  294.       for i in appellation.param
  295.         case i[0]
  296.         when /HP/i
  297.           @appe_hp = i[1]
  298.           @appe_hpper = i[2] == nil ? false : true
  299.         when /MP/i
  300.           @appe_mp = i[1]
  301.           @appe_mpper = i[2] == nil ? false : true
  302.         when /ATK/i
  303.           @appe_atk = i[1]
  304.           @appe_atkper = i[2] == nil ? false : true
  305.         when /DEF/i
  306.           @appe_def = i[1]
  307.           @appe_defper = i[2] == nil ? false : true
  308.         when /SPI/i
  309.           @appe_spi = i[1]
  310.           @appe_spiper = i[2] == nil ? false : true
  311.         when /AGI/i
  312.           @appe_agi = i[1]
  313.           @appe_agiper = i[2] == nil ? false : true
  314.         when /GOLD/i
  315.           @appe_gold = i[1]
  316.           @appe_goldper = i[2] == nil ? false : true
  317.         when /EXP/i
  318.           @appe_exp = i[1]
  319.           @appe_expper = i[2] == nil ? false : true
  320.         else
  321.           next
  322.         end
  323.       end
  324.     end
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● 获取基本体力最大值
  328.   #--------------------------------------------------------------------------
  329.   alias appellation_base_maxhp base_maxhp
  330.   def base_maxhp
  331.     n = appellation_base_maxhp
  332.     if @appe_hpper == true
  333.       n += actor.parameters[0, @level] * @appe_hp / 100
  334.     else
  335.       n += @appe_hp
  336.     end
  337.     return n
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● 获取基本魔力最大值
  341.   #--------------------------------------------------------------------------
  342.   alias appellation_base_maxmp base_maxmp
  343.   def base_maxmp
  344.     n = appellation_base_maxmp
  345.     if @appe_mpper == true
  346.       n += actor.parameters[1, @level] * @appe_mp / 100
  347.     else
  348.       n += @appe_mp
  349.     end
  350.     return n
  351.   end
  352.   #--------------------------------------------------------------------------
  353.   # ● 获取基本攻击力
  354.   #--------------------------------------------------------------------------
  355.   alias appellation_base_atk base_atk
  356.   def base_atk
  357.     n = appellation_base_atk
  358.     if @appe_atkper == true
  359.       n += actor.parameters[2, @level] * @appe_atk / 100
  360.     else
  361.       n += @appe_atk
  362.     end
  363.     return n
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # ● 获取基本防御力
  367.   #--------------------------------------------------------------------------
  368.   alias appellation_base_def base_def
  369.   def base_def
  370.     n = appellation_base_def
  371.     if @appe_defper == true
  372.       n += actor.parameters[3, @level] * @appe_def / 100
  373.     else
  374.       n += @appe_def
  375.     end
  376.     return n
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   # ● 获取基本精神力
  380.   #--------------------------------------------------------------------------
  381.   alias appellation_base_spi base_spi
  382.   def base_spi
  383.     n = appellation_base_spi
  384.     if @appe_spiper == true
  385.       n += actor.parameters[4, @level] * @appe_spi / 100
  386.     else
  387.       n += @appe_spi
  388.     end
  389.     return n
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # ● 获取基本敏捷
  393.   #--------------------------------------------------------------------------
  394.   alias appellation_base_agi base_agi
  395.   def base_agi
  396.     n = appellation_base_agi
  397.     if @appe_agiper == true
  398.       n += actor.parameters[5, @level] * @appe_agi / 100
  399.     else
  400.       n += @appe_agi
  401.     end
  402.     return n
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ● 获取经验(获取双倍经验值用)
  406.   #     exp  : 经验值量
  407.   #     show : 显示等级提示标志
  408.   #--------------------------------------------------------------------------
  409.   alias appellation_gain_exp gain_exp
  410.   def gain_exp(exp, show)
  411.     exp += exp * @appe_exp / 100
  412.     appellation_gain_exp(exp, show)
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● 升级
  416.   #--------------------------------------------------------------------------
  417.   alias appellation_level_up level_up
  418.   def level_up
  419.     appellation_level_up
  420.     refresh_appellation
  421.   end
  422. end
  423. #==============================================================================
  424. # ■ Game_Troop
  425. #------------------------------------------------------------------------------
  426. #  处理敌人队伍和战斗相关资料的类,也可执行如战斗事件管理之类的功能。
  427. # 本类的实例请参考 $game_troop。
  428. #==============================================================================

  429. class Game_Troop < Game_Unit
  430.   alias appellation_gold_total gold_total
  431.   #--------------------------------------------------------------------------
  432.   # ● 计算金钱总数
  433.   #--------------------------------------------------------------------------
  434.   def gold_total
  435.     gold = appellation_gold_total
  436.     per = $game_party.appe_gold_per
  437.     gold += gold * per / 100
  438.     return gold
  439.   end
  440. end
  441. #==============================================================================
  442. # ■ Game_Party
  443. #------------------------------------------------------------------------------
  444. #  处理同伴的类。包含金钱以及物品的信息。本类的实例请参考 $game_party。
  445. #==============================================================================

  446. class Game_Party < Game_Unit
  447.   #--------------------------------------------------------------------------
  448.   # ● 计算称号金钱获得影响量
  449.   #--------------------------------------------------------------------------
  450.   def appe_gold_per
  451.     per = 0
  452.     for member in members
  453.       per += member.appe_gold
  454.     end
  455.     return per
  456.   end
  457. end

  458. #★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
  459. # 华丽的分割线2
  460. # 以下插入指令的方法从KGC的脚本内取出。版权归KGC
  461. #★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
  462. #==============================================================================
  463. # ■ Window_Command
  464. #==============================================================================

  465. class Window_Command < Window_Selectable
  466.   unless method_defined?(:add_command)
  467.   #--------------------------------------------------------------------------
  468.   # ○ コマンドを追加
  469.   #    追加した位置を返す
  470.   #--------------------------------------------------------------------------
  471.   def add_command(command)
  472.     @commands << command
  473.     @item_max = @commands.size
  474.     item_index = @item_max - 1
  475.     refresh_command
  476.     draw_item(item_index)
  477.     return item_index
  478.   end
  479.   #--------------------------------------------------------------------------
  480.   # ○ コマンドをリフレッシュ
  481.   #--------------------------------------------------------------------------
  482.   def refresh_command
  483.     buf = self.contents.clone
  484.     self.height = [self.height, row_max * WLH + 32].max
  485.     create_contents
  486.     self.contents.blt(0, 0, buf, buf.rect)
  487.     buf.dispose
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # ○ コマンドを挿入
  491.   #--------------------------------------------------------------------------
  492.   def insert_command(index, command)
  493.     @commands.insert(index, command)
  494.     @item_max = @commands.size
  495.     refresh_command
  496.     refresh
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # ○ コマンドを削除
  500.   #--------------------------------------------------------------------------
  501.   def remove_command(command)
  502.     @commands.delete(command)
  503.     @item_max = @commands.size
  504.     refresh
  505.   end
  506.   end
  507. end
  508. #==============================================================================
  509. # ■ Scene_Menu
  510. #==============================================================================

  511. class Scene_Menu < Scene_Base
  512.   if Kien::Appellation::ADD_APPELLATION_COMMAND == 1
  513.   #--------------------------------------------------------------------------
  514.   # ● コマンドウィンドウの作成
  515.   #--------------------------------------------------------------------------
  516.   alias create_command_window_appellation create_command_window
  517.   def create_command_window
  518.     create_command_window_appellation
  519.     @command_appellation_index =
  520.       @command_window.add_command(Vocab.appellation_command_name)
  521.     if @command_window.oy > 0
  522.       @command_window.oy -= Window_Base::WLH
  523.     end
  524.     @command_window.index = @menu_index
  525.   end
  526.   end
  527.   #--------------------------------------------------------------------------
  528.   # ● コマンド選択の更新
  529.   #--------------------------------------------------------------------------
  530.   alias update_command_selection_appellation update_command_selection
  531.   def update_command_selection
  532.     call_distribute_parameter_flag = false
  533.     if Input.trigger?(Input::C)
  534.       case @command_window.index
  535.       when @command_appellation_index  # パラメータ振り分け
  536.         call_appellation_flag = true
  537.       end
  538.     end

  539.     # パラメータ振り分け画面に移行
  540.     if call_appellation_flag
  541.       if $game_party.members.size == 0
  542.         Sound.play_buzzer
  543.         return
  544.       end
  545.       Sound.play_decision
  546.       start_actor_selection
  547.       return
  548.     end

  549.     update_command_selection_appellation
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ● アクター選択の更新
  553.   #--------------------------------------------------------------------------
  554.   alias update_actor_selection_appellation update_actor_selection
  555.   def update_actor_selection
  556.     if Input.trigger?(Input::C)
  557.       $game_party.last_actor_index = @status_window.index
  558.       Sound.play_decision
  559.       case @command_window.index
  560.       when @command_appellation_index  # 更换称号。
  561.         $scene = Scene_Appellation.new(
  562.           @status_window.index,
  563.           @command_appellation_index,
  564.           Kien::Appellation::ADD_APPELLATION_COMMAND)
  565.         return
  566.       end
  567.     end

  568.     update_actor_selection_appellation
  569.   end
  570. end
  571. #★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
  572. # 华丽的分割线3号
  573. # 以下回归原创
  574. #★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼★☆●○▲△■□▼
  575. #==============================================================================
  576. # ■ Window_Base
  577. #------------------------------------------------------------------------------
  578. #  游戏中全部窗口的超级类。
  579. #==============================================================================

  580. class Window_Base < Window
  581.   #--------------------------------------------------------------------------
  582.   # ● 绘制角色称号
  583.   #     actor : 角色
  584.   #     x     : 描画目标 X 坐标
  585.   #     y     : 描画目标 Y 坐标
  586.   #--------------------------------------------------------------------------
  587.   def draw_actor_appellation(actor, x, y)
  588.     self.contents.font.color = normal_color
  589.     self.contents.draw_text(x, y, 108, WLH, actor.appellation.name)
  590.   end
  591. end
  592. #==============================================================================
  593. # ■ Window_AppellationStatus
  594. #------------------------------------------------------------------------------
  595. #  更换称号时显示角色能力值变化的窗口。
  596. #==============================================================================

  597. class Window_AppellationStatus < Window_Base
  598.   #--------------------------------------------------------------------------
  599.   # ● 初始化对像
  600.   #     x      : 窗口 X 座标
  601.   #     y      : 窗口 Y 座标
  602.   #     actor  : 角色
  603.   #--------------------------------------------------------------------------
  604.   def initialize(actor)
  605.     super(0, 0, 208, 316)
  606.     @actor = actor
  607.     refresh
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # ● 刷新
  611.   #--------------------------------------------------------------------------
  612.   def refresh
  613.     self.contents.clear
  614.     draw_actor_name(@actor, 4, 0)
  615.     draw_actor_face(@actor, 0, WLH * 1)
  616.     draw_actor_appellation(@actor, 0, WLH * 2 + 72)
  617.     draw_parameter(0, WLH * 3 + 72, 4)
  618.     draw_parameter(0, WLH * 4 + 72, 5)
  619.     draw_parameter(0, WLH * 5 + 72, 0)
  620.     draw_parameter(0, WLH * 6 + 72, 1)
  621.     draw_parameter(0, WLH * 7 + 72, 2)
  622.     draw_parameter(0, WLH * 8 + 72, 3)
  623.   end
  624.   #--------------------------------------------------------------------------
  625.   # ● 设置装备後的能力值
  626.   #     new_atk : 装备後的攻击力
  627.   #     new_def : 装备後的防御力
  628.   #     new_spi : 装备後的精神力
  629.   #     new_agi : 装备後的敏捷
  630.   #--------------------------------------------------------------------------
  631.   def set_new_parameters(new_atk, new_def, new_spi, new_agi, new_hp, new_mp)
  632.     if @new_atk != new_atk or @new_def != new_def or
  633.        @new_spi != new_spi or @new_agi != new_agi
  634.       @new_atk = new_atk
  635.       @new_def = new_def
  636.       @new_spi = new_spi
  637.       @new_agi = new_agi
  638.       @new_hp = new_hp
  639.       @new_mp = new_mp
  640.       refresh
  641.     end
  642.   end
  643.   #--------------------------------------------------------------------------
  644.   # ● 获取装备後的能力值文字颜色
  645.   #     old_value : 装备前的能力值
  646.   #     new_value : 装备後的能力值
  647.   #--------------------------------------------------------------------------
  648.   def new_parameter_color(old_value, new_value)
  649.     if new_value > old_value      # 增强
  650.       return power_up_color
  651.     elsif new_value == old_value  # 不变
  652.       return normal_color
  653.     else                          # 减弱
  654.       return power_down_color
  655.     end
  656.   end
  657.   #--------------------------------------------------------------------------
  658.   # ● 绘制能力值
  659.   #     x    : 绘制点 X 座标
  660.   #     y    : 绘制点 Y 座标
  661.   #     type : 能力值 (0:攻击力、1:防御力、2:精神力、3:敏捷)
  662.   #--------------------------------------------------------------------------
  663.   def draw_parameter(x, y, type)
  664.     case type
  665.     when 0
  666.       name = Vocab::atk
  667.       value = @actor.atk
  668.       new_value = @new_atk
  669.     when 1
  670.       name = Vocab::def
  671.       value = @actor.def
  672.       new_value = @new_def
  673.     when 2
  674.       name = Vocab::spi
  675.       value = @actor.spi
  676.       new_value = @new_spi
  677.     when 3
  678.       name = Vocab::agi
  679.       value = @actor.agi
  680.       new_value = @new_agi
  681.     when 4
  682.       name = "最大" + Vocab::hp
  683.       value = @actor.maxhp
  684.       new_value = @new_hp
  685.     when 5
  686.       name = "最大" + Vocab::mp
  687.       value = @actor.maxmp
  688.       new_value = @new_mp
  689.     end
  690.     self.contents.font.color = system_color
  691.     self.contents.draw_text(x + 4, y, 80, WLH, name)
  692.     self.contents.font.color = normal_color
  693.     self.contents.draw_text(x + 90, y, 30, WLH, value, 2)
  694.     if new_value != nil
  695.       self.contents.font.color = system_color
  696.       self.contents.draw_text(x + 122, y, 20, WLH, ">", 1)
  697.       self.contents.font.color = new_parameter_color(value, new_value)
  698.       self.contents.draw_text(x + 142, y, 30, WLH, new_value, 2)
  699.     end
  700.   end
  701. end
  702. #==============================================================================
  703. # ■ Window_SelectAppellation
  704. #------------------------------------------------------------------------------
  705. #  选择称号的窗口。
  706. #==============================================================================

  707. class Window_SelectAppellation < Window_Selectable
  708.   #--------------------------------------------------------------------------
  709.   # ● 初始化对像
  710.   #     actor  : 角色
  711.   #--------------------------------------------------------------------------
  712.   def initialize(actor)
  713.     @actor = actor
  714.     super(208, 0, 336, 316)
  715.     @column_max = 2
  716.     self.index = 0
  717.     self.active = true
  718.     refresh
  719.   end
  720.   #--------------------------------------------------------------------------
  721.   # ● 刷新
  722.   #--------------------------------------------------------------------------
  723.   def refresh
  724.     @appellation_list = @actor.appellation_list
  725.     @item_max = @appellation_list.size
  726.     create_contents
  727.     for i in 0...@item_max
  728.       draw_item(i)
  729.     end
  730.   end
  731.   #--------------------------------------------------------------------------
  732.   # ● 获取称号
  733.   #--------------------------------------------------------------------------
  734.   def appellation
  735.     return @appellation_list[self.index]
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # ● 描绘项目
  739.   #     index : 项目编号
  740.   #--------------------------------------------------------------------------
  741.   def draw_item(index)
  742.     rect = item_rect(index)
  743.     self.contents.clear_rect(rect)
  744.     appe = @appellation_list[index]
  745.     if appe.enable == true
  746.       self.contents.font.color = normal_color
  747.       self.contents.font.color.alpha = 255
  748.       self.contents.draw_text(rect, appe.name, 1)
  749.     else
  750.       self.contents.font.color = normal_color
  751.       self.contents.font.color.alpha = 128
  752.       self.contents.draw_text(rect, Kien::Appellation::UNENABLE_NAME, 1)
  753.     end
  754.   end
  755. end
  756. #==============================================================================
  757. # ■ Window_AppellationData
  758. #------------------------------------------------------------------------------
  759. #  称号说明。
  760. #==============================================================================

  761. class Window_AppellationData < Window_Base
  762.   #--------------------------------------------------------------------------
  763.   # ● 初始化对像
  764.   #--------------------------------------------------------------------------
  765.   def initialize
  766.     super(0, 316, 544, 100)
  767.     @appe = nil
  768.   end
  769.   #--------------------------------------------------------------------------
  770.   # ● 更新画面
  771.   #--------------------------------------------------------------------------
  772.   def update(appe)
  773.     super()
  774.     if appe != @appe
  775.       @appe = appe
  776.       self.contents.clear
  777.       if @appe.enable == true
  778.         self.contents.draw_text(0, WLH * 0, 544, WLH, @appe.description)
  779.         draw_effect
  780.       else
  781.         self.contents.draw_text(0, WLH * 0, 544, WLH, "你还没有得到这个称号")
  782.       end
  783.     end
  784.   end
  785.   #--------------------------------------------------------------------------
  786.   # ● 更新画面
  787.   #--------------------------------------------------------------------------
  788.   def draw_effect
  789.     if @appe.param == nil
  790.       self.contents.draw_text(0, WLH * 1, 544, WLH, "无属性")
  791.     else
  792.       x = 0
  793.       line = 1
  794.       for effect in @appe.param
  795.         case effect[0]
  796.         when /HP/i
  797.           param = "最大" + Vocab::hp
  798.         when /MP/i
  799.           param = "最大" + Vocab::mp
  800.         when /ATK/i
  801.           param = Vocab::atk
  802.         when /DEF/i
  803.           param = Vocab::def
  804.         when /AGI/i
  805.           param = Vocab::agi
  806.         when /SPI/i
  807.           param = Vocab::spi
  808.         when /EXP/i
  809.           param = "获得经验"
  810.         when /GOLD/i
  811.           param = "获得金钱"
  812.         end
  813.         word = effect[1] > 0 ? "+" + effect[1].to_i.to_s : effect[1].to_i.to_s
  814.         word = effect[2] == nil ? word : word + "%"
  815.         width = contents.text_size(param).width
  816.         width += contents.text_size(word).width
  817.         if x + width > 544 and line == 1
  818.           line = 2
  819.           x = 0
  820.         end
  821.         if x + width > 544 and line == 2
  822.           break
  823.         end
  824.         self.contents.draw_text(x, WLH * line, width, WLH, param)
  825.         self.contents.draw_text(x, WLH * line, width, WLH, word, 2)
  826.         x += width + 32
  827.       end
  828.     end
  829.   end
  830. end

  831. #==============================================================================
  832. # ■ Window_Status
  833. #------------------------------------------------------------------------------
  834. #  显示状态画面、完全规格的状态窗口。
  835. #==============================================================================

  836. class Window_Status < Window_Base
  837.   alias appellation_refresh refresh
  838.   #--------------------------------------------------------------------------
  839.   # ● 刷新
  840.   #--------------------------------------------------------------------------
  841.   def refresh
  842.     appellation_refresh
  843.     draw_actor_appellation(@actor, 256, 0)
  844.   end
  845. end

  846. #==============================================================================
  847. # ■ Scene_Status
  848. #------------------------------------------------------------------------------
  849. #  处理状态画面的类。
  850. #==============================================================================

  851. class Scene_Status < Scene_Base
  852. if Kien::Appellation::ADD_APPELLATION_COMMAND == 2
  853.   alias appellation_start start
  854.   #--------------------------------------------------------------------------
  855.   # ● 开始处理
  856.   #--------------------------------------------------------------------------
  857.   def start
  858.     appellation_start
  859.     create_command_window
  860.   end
  861.   #--------------------------------------------------------------------------
  862.   # ● 生成命令窗口
  863.   #--------------------------------------------------------------------------
  864.   def create_command_window
  865.     s1 = "变更称号"
  866.     s2 = "取消"
  867.     @command_window = Window_Command.new(128, [s1, s2])
  868.     @command_window.active = false
  869.     @command_window.openness = 0
  870.     @command_window.x = 544 / 2 - 128 / 2
  871.     @command_window.y = 416 / 2 - (Window_Base::WLH * 2 + 32) / 2
  872.   end
  873.   alias appellation_terminate terminate
  874.   #--------------------------------------------------------------------------
  875.   # ● 结束处理
  876.   #--------------------------------------------------------------------------
  877.   def terminate
  878.     appellation_terminate
  879.     @command_window.dispose
  880.   end
  881.   alias appellation_update update
  882.   #--------------------------------------------------------------------------
  883.   # ● 更新画面
  884.   #--------------------------------------------------------------------------
  885.   def update
  886.     @command_window.update
  887.     if @command_window.active
  888.       if Input.trigger?(Input::C)
  889.         Sound.play_decision
  890.         $scene = Scene_Appellation.new(@actor_index)
  891.       elsif Input.trigger?(Input::B)
  892.         Sound.play_cancel
  893.         @command_window.close
  894.         @command_window.active = false
  895.         return
  896.       end
  897.     else
  898.       if Input.trigger?(Input::C)
  899.         Sound.play_decision
  900.         @command_window.open
  901.         @command_window.active = true
  902.       return
  903.       end
  904.       appellation_update
  905.     end
  906.   end
  907. end
  908. end
  909. #==============================================================================
  910. # ■ Scene_Appellation
  911. #------------------------------------------------------------------------------
  912. #  处理更换称号的类。
  913. #==============================================================================

  914. class Scene_Appellation < Scene_Base
  915.   #--------------------------------------------------------------------------
  916.   # ● 初始化对像
  917.   #     actor_index : 角色 ID
  918.   #     menu_index  : 命令窗口光标初始位置
  919.   #     host_scene  : 上个场景(0..地图, 1..菜单, 2..状态画面)
  920.   #--------------------------------------------------------------------------
  921.   def initialize(actor_index = 1, menu_index = 0, host_scene = Kien::Appellation::ADD_APPELLATION_COMMAND)
  922.     @actor_index = actor_index
  923.     @menu_index = menu_index
  924.     @host_scene = host_scene
  925.   end
  926.   #--------------------------------------------------------------------------
  927.   # ● 开始处理
  928.   #--------------------------------------------------------------------------
  929.   def start
  930.     create_menu_background
  931.     @actor = $game_party.members[@actor_index]
  932.     @appellation_status = Window_AppellationStatus.new(@actor)
  933.     @appellation_select = Window_SelectAppellation.new(@actor)
  934.     @appellation_data = Window_AppellationData.new
  935.     create_command_window
  936.   end
  937.   #--------------------------------------------------------------------------
  938.   # ● 生成命令窗口
  939.   #--------------------------------------------------------------------------
  940.   def create_command_window
  941.     s1 = "装备称号"
  942.     s2 = "取消"
  943.     @command_window = Window_Command.new(128, [s1, s2])
  944.     @command_window.active = false
  945.     @command_window.openness = 0
  946.   end
  947.   #--------------------------------------------------------------------------
  948.   # ● 更新画面
  949.   #--------------------------------------------------------------------------
  950.   def update
  951.     @appellation_status.update
  952.     @appellation_select.update
  953.     @appellation_data.update(@appellation_select.appellation)
  954.     @command_window.update
  955.     if @appellation_select.active
  956.       if Input.trigger?(Input::B)
  957.         Sound.play_cancel
  958.         return_scene
  959.       elsif Input.trigger?(Input::C)
  960.         Sound.play_decision
  961.         show_command_window
  962.       end
  963.     elsif @command_window.active
  964.       if Input.trigger?(Input::B)
  965.         Sound.play_cancel
  966.         close_command_window
  967.       elsif Input.trigger?(Input::C)
  968.         case @command_window.index
  969.         when 0
  970.           if @appellation_select.index == @actor.appellation_id or @appellation_select.appellation.enable == false
  971.             Sound.play_buzzer
  972.             return
  973.           else
  974.             Sound.play_decision
  975.             change_appellation
  976.           end
  977.         when 1
  978.           Sound.play_decision
  979.           close_command_window
  980.         end
  981.       end
  982.     end
  983.   end
  984.   #--------------------------------------------------------------------------
  985.   # ● 结束处理
  986.   #--------------------------------------------------------------------------
  987.   def terminate
  988.     @appellation_status.dispose
  989.     @appellation_select.dispose
  990.     @appellation_data.dispose
  991.     @command_window.dispose
  992.   end
  993.   #--------------------------------------------------------------------------
  994.   # ● 显示命令窗口
  995.   #--------------------------------------------------------------------------
  996.   def show_command_window
  997.     @command_window.x = @appellation_select.index % 2 == 0 ? 208 : 376
  998.     @command_window.y = @appellation_select.item_rect(@appellation_select.index).y
  999.     if @command_window.y > Window_Base::WLH * 2 + 32
  1000.       @command_window.y -= Window_Base::WLH * 2 + 32
  1001.     else
  1002.       @command_window.y += Window_Base::WLH
  1003.     end
  1004.     @command_window.z = 100
  1005.     @command_window.open
  1006.     if @appellation_select.index == @actor.appellation_id or @appellation_select.appellation.enable == false
  1007.       @command_window.draw_item(0, false)
  1008.     else
  1009.       @command_window.draw_item(0, true)
  1010.     end
  1011.     @command_window.active = true
  1012.     @appellation_select.active = false
  1013.   end
  1014.   #--------------------------------------------------------------------------
  1015.   # ● 关闭命令窗口
  1016.   #--------------------------------------------------------------------------
  1017.   def close_command_window
  1018.     @command_window.close
  1019.     @command_window.active = false
  1020.     @appellation_select.active = true
  1021.   end
  1022.   #--------------------------------------------------------------------------
  1023.   # ● 更换称号
  1024.   #--------------------------------------------------------------------------
  1025.   def change_appellation
  1026.     @actor.change_appellation(@appellation_select.index)
  1027.     @appellation_status.refresh
  1028.     close_command_window
  1029.   end
  1030.   #--------------------------------------------------------------------------
  1031.   # ● 回到原画面
  1032.   #--------------------------------------------------------------------------
  1033.   def return_scene
  1034.     if @host_scene == 1
  1035.       $scene = Scene_Menu.new(@menu_index)
  1036.     elsif @host_scene == 2
  1037.       $scene = Scene_Status.new(@actor_index)
  1038.     else
  1039.       $scene = Scene_Map.new
  1040.     end
  1041.   end
  1042. end
  1043. #============================================================================
  1044. # ☆ 仿传说称号系统。
  1045. #    由feizhaodan制作。
  1046. #    发布于66RPG
  1047. #    http://rpg.blue/
  1048. #    版本号: 1.2.3
  1049. #    2011/12/11
  1050. #    转载时请连同这里一起转
  1051. #============================================================================
复制代码
范例:
称号系统.zip (261.33 KB, 下载次数: 4290)
称2.jpg

称号系统.zip

260.95 KB, 下载次数: 11995

评分

参与人数 4星屑 +1312 收起 理由
Sonic1997 + 532 神奇+2147483648
冰舞蝶恋 + 600 神奇+10086
RPGmaster + 90 神奇+1
月夜神音 + 90 真神奇

查看全部评分

Lv4.逐梦者

醉啸 长风万里

梦石
0
星屑
6047
在线时间
6586 小时
注册时间
2007-12-16
帖子
4501

贵宾

发表于 2011-9-28 10:17:26 | 显示全部楼层
来学习,扩展思路,争取用在SRPG中

还在龟速填坑中
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1224
在线时间
667 小时
注册时间
2009-11-11
帖子
2787
发表于 2011-9-28 11:09:37 | 显示全部楼层
乃需要向5000行迈进

点评

= = 努力吧  发表于 2011-9-28 18:17

嘿。嘿。嘿
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
48
在线时间
678 小时
注册时间
2010-8-11
帖子
1533
发表于 2011-9-28 20:33:15 | 显示全部楼层
本帖最后由 RPGmaster 于 2011-9-28 13:35 编辑

我[~~~~毕~~~~],这么强,话说不能在状态内替换么?
表示想起了心灵传说……
在状态内更换的……(应该是吧……难道我记忆力就这么差么QAQ)

点评

编的时候没想到。最近有点忙,十一休假时会改。  发表于 2011-9-28 20:43
小艾工作室开张= =
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
71
在线时间
288 小时
注册时间
2011-9-22
帖子
226
发表于 2011-9-29 06:47:05 | 显示全部楼层
捏,话说图呢QAQ
http://img165.poco.cn/mypoco/myphoto/20110922/20/6420219220110922203357086.jpg
永不停歇的追尋者。
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (版主)

  /) /)<

梦石
0
星屑
4207
在线时间
4890 小时
注册时间
2009-2-16
帖子
8434

开拓者短篇七成年组季军

发表于 2011-9-29 08:21:10 | 显示全部楼层
什么叫仿传说式称号?
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
39357
在线时间
7471 小时
注册时间
2009-7-6
帖子
13482

开拓者贵宾

发表于 2011-9-30 11:37:52 | 显示全部楼层
称号属性真够创意的XD
RGDirect - DirectX驱动的RGSS,点我了解.
RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复 支持 反对

使用道具 举报

Lv1.梦旅人

龙神

梦石
0
星屑
47
在线时间
512 小时
注册时间
2011-1-19
帖子
984
发表于 2011-9-30 13:03:32 | 显示全部楼层
这个%很厉害耶,怎么弄的??教教我脚本吧。。

点评

F1帮助--〉RGSS参考文件--〉附录--〉正则表达式好好对比看看80行  发表于 2011-9-30 17:07


神的穿越 THRU OF GOD  完成度1%
脚本2%  行走图10%  剧情1%
复仇の怪物    完成度7%
脚本10%  行走图10%  剧情5%
回复 支持 反对

使用道具 举报

Lv3.寻梦者

不活君

梦石
0
星屑
1080
在线时间
1202 小时
注册时间
2011-2-16
帖子
680
发表于 2011-9-30 17:07:00 | 显示全部楼层
:LLZ厉害啊。。不过您能不能弄个范例 照顾下我这个脚本白痴呢?

点评

额。。鼠标。。真的~  发表于 2012-1-14 13:23
突然发现你的签名里有跑龙套的鼠标  发表于 2011-9-30 18:43
不知不觉就几百天过去了 经历无数个雨夜 清晨 黎明 先是兴奋 厌倦 释然 会觉得很有趣 然后又会觉得无趣 最后有一种归属感 满足感
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
459 小时
注册时间
2010-6-22
帖子
491
发表于 2011-9-30 19:08:24 | 显示全部楼层
好物抱走~
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 23:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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