- #============================================================================== 
- # ★ 【角色转生系统】★ 
- #------------------------------------------------------------------------------ 
- # ☆  by 芯☆淡茹水   
- #============================================================================== 
- #◆ 使用方法: 
- #        复制该脚本,插入到 Main 前。 
- #        召唤转生系统的方法:事件 → 脚本  写入  $scene = Scene_Lx.new 
- #=============================================================================== 
- #◆ 说明: 
- #        和一些网游的转生类似。角色随着转生次数的增加,各种属性(hp,sp,力量, 
- #      灵巧,,,等)的初始值会越来越高,而每升一级增加的属性也会越来越多。 
- #      (注意:数据库各角色的初始等级都设置为 1 级。) 
- # 
- #       由于手动设置的项目较多,在使用前,请先仔细阅读并设置下面的设置项。 
- # 
- #============================================================================== 
- #◆ 设置: 
- #================] 
- #------------------------------------------------------------------------------ 
- LX_LEVEL = 60       #达到转生要求的最低等级。 
- #------------------------------------------------------------------------------ 
- LX_VARIABLE = 200   #储存各角色转生次数的起始变量。比如:设置为 200 ,那么1号角 
- #                    色转生次数储存在 201 号变量,2号角色储存在 202 号变量,,, 
- #------------------------------------------------------------------------------ 
- LX_N = 10           #转生前,角色的各属性除以设定的这个值,再乘以转生次数,加入 
- #                    到转生后的属性中。这个设定的值越高,加入转生后的属性就越 
- #                    少,反之就越多。 
- #------------------------------------------------------------------------------ 
- LX_DX = false        #转生次数限制,限制写 true       不限制写  false 
- #------------------------------------------------------------------------------ 
- LX_DX_N = 5         #转生最高次数限制,上面的限制设置写 true  该项才有效。 
- #------------------------------------------------------------------------------ 
- LX_CLASS = false      #转生后是否改变角色职业,是 写入 true    否 写入 false  
- #------------------------------------------------------------------------------ 
- LX_CLASS_ID = 1      #转生后,角色的职业ID。上面是否改变职业设置写 true 
- #                     该设置才有效。 
- #                     比如转生后,全部转为 1 号职业,从“新手”做起。 
- #------------------------------------------------------------------------------ 
- LX_EVENT_ID = 1      #转生成功后激活的公共事件ID。公共事件里可设置一些转生成功后 
- #                    播放动画,以及一些提示等。 
- #------------------------------------------------------------------------------ 
- LEVEL_UP = true     #推荐配合使用升级加点系统。如果工程里有升级加点系统 
- #                    请写 true    没有则写 false  
- #============================================================================== 
- ##转生后角色各属性增加度设置: 
- #------------------------------------------------------------------------------ 
- #(角色每升一级增加的属性 = 数据库设置的基本值 + 下面设置的增加度 乘以 转生次数) 
- #(比如设置HP为 10  ,转生 0 次 角色每升一级,角色的HP多增加 0 点; 
- #  转生 1 次 多增加 10 点;转生 2 次 多增加 20 点,,,,;以此类推。) 
- #------------------------------------------------------------------------------ 
- LX_EXP = 2           # EXP曲线基础值和增加度。(一般设为 1 — 10) 
- #------------------------------------------------------------------------------ 
- LX_HP = 10           # HP 
- #------------------------------------------------------------------------------ 
- LX_SP = 8            # SP 
- #------------------------------------------------------------------------------ 
- LX_STATE = 1         # 四项属性(力量,灵巧,速度,魔力) 
- #============================================================================== 
- ############################################################################### 
- #============================================================================== 
- #★ 重新定义角色各属性 
- #============================================================================== 
- class Game_Actor < Game_Battler 
-   #-------------------------------------------------------------------------- 
-   # ● 计算 EXP 
-   #-------------------------------------------------------------------------- 
-   def make_exp_list 
-     actor = $data_actors[@actor_id] 
-     lx = ($game_variables[@actor_id + LX_VARIABLE] + 1) * LX_EXP 
-     actor.exp_inflation += lx 
-     actor.exp_basis += lx 
-     @exp_list[1] = 0 
-     pow_i = 2.4 + actor.exp_inflation / 100.0 
-     for i in 2..100 
-       if i > actor.final_level 
-         @exp_list[i] = 0 
-       else 
-         n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i) 
-         @exp_list[i] = @exp_list[i-1] + Integer(n) 
-       end 
-     end 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 获取基本 MaxHP 
-   #-------------------------------------------------------------------------- 
-   def base_maxhp 
-     lx = $game_variables[@actor_id + LX_VARIABLE] * @level 
-     return $data_actors[@actor_id].parameters[0, @level] + lx * LX_HP 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 获取基本 MaxSP 
-   #-------------------------------------------------------------------------- 
-   def base_maxsp 
-     lx = $game_variables[@actor_id + LX_VARIABLE] * @level 
-     return $data_actors[@actor_id].parameters[1, @level] + lx * LX_SP 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 获取基本力量 
-   #-------------------------------------------------------------------------- 
-   def base_str 
-     lx = $game_variables[@actor_id + LX_VARIABLE] * @level 
-     n = $data_actors[@actor_id].parameters[2, @level] + lx * LX_STATE  
-     weapon = $data_weapons[@weapon_id] 
-     armor1 = $data_armors[@armor1_id] 
-     armor2 = $data_armors[@armor2_id] 
-     armor3 = $data_armors[@armor3_id] 
-     armor4 = $data_armors[@armor4_id] 
-     n += weapon != nil ? weapon.str_plus : 0 
-     n += armor1 != nil ? armor1.str_plus : 0 
-     n += armor2 != nil ? armor2.str_plus : 0 
-     n += armor3 != nil ? armor3.str_plus : 0 
-     n += armor4 != nil ? armor4.str_plus : 0 
-     return [[n, 1].max, 999].min 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 获取基本灵巧 
-   #-------------------------------------------------------------------------- 
-   def base_dex 
-     lx = $game_variables[@actor_id + LX_VARIABLE] * @level 
-     n = $data_actors[@actor_id].parameters[3, @level] + lx * LX_STATE 
-     weapon = $data_weapons[@weapon_id] 
-     armor1 = $data_armors[@armor1_id] 
-     armor2 = $data_armors[@armor2_id] 
-     armor3 = $data_armors[@armor3_id] 
-     armor4 = $data_armors[@armor4_id] 
-     n += weapon != nil ? weapon.dex_plus : 0 
-     n += armor1 != nil ? armor1.dex_plus : 0 
-     n += armor2 != nil ? armor2.dex_plus : 0 
-     n += armor3 != nil ? armor3.dex_plus : 0 
-     n += armor4 != nil ? armor4.dex_plus : 0 
-     return [[n, 1].max, 999].min 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 获取基本速度 
-   #-------------------------------------------------------------------------- 
-   def base_agi 
-     lx = $game_variables[@actor_id + LX_VARIABLE] * @level 
-     n = $data_actors[@actor_id].parameters[4, @level] + lx * LX_STATE 
-     weapon = $data_weapons[@weapon_id] 
-     armor1 = $data_armors[@armor1_id] 
-     armor2 = $data_armors[@armor2_id] 
-     armor3 = $data_armors[@armor3_id] 
-     armor4 = $data_armors[@armor4_id] 
-     n += weapon != nil ? weapon.agi_plus : 0 
-     n += armor1 != nil ? armor1.agi_plus : 0 
-     n += armor2 != nil ? armor2.agi_plus : 0 
-     n += armor3 != nil ? armor3.agi_plus : 0 
-     n += armor4 != nil ? armor4.agi_plus : 0 
-     return [[n, 1].max, 999].min 
-   end 
-   #-------------------------------------------------------------------------- 
-   # ● 获取基本魔力 
-   #-------------------------------------------------------------------------- 
-   def base_int 
-     lx = $game_variables[@actor_id + LX_VARIABLE] * @level 
-     n = $data_actors[@actor_id].parameters[5, @level] + lx * LX_STATE 
-     weapon = $data_weapons[@weapon_id] 
-     armor1 = $data_armors[@armor1_id] 
-     armor2 = $data_armors[@armor2_id] 
-     armor3 = $data_armors[@armor3_id] 
-     armor4 = $data_armors[@armor4_id] 
-     n += weapon != nil ? weapon.int_plus : 0 
-     n += armor1 != nil ? armor1.int_plus : 0 
-     n += armor2 != nil ? armor2.int_plus : 0 
-     n += armor3 != nil ? armor3.int_plus : 0 
-     n += armor4 != nil ? armor4.int_plus : 0 
-     return [[n, 1].max, 999].min 
-   end 
- end 
- ############################################################################### 
- #============================================================================== 
- #★ 转生场景 
- #============================================================================== 
- class Scene_Lx 
-   def main 
-     #选择窗口 
-     @command_window = Window_LxCommand.new 
-     @command_window.visible = false 
-     #帮助窗口 
-     @help_window = Window_LxHelp.new 
-     #状态窗口 
-     @status_window = Window_LxStatus.new 
-     #背景窗口 
-     @lxa_window = Window_LxBack.new 
-     @lxa_window.y = 64 
-     @lxb_window = Window_LxBack.new 
-     @lxb_window.y = 168 
-     @lxc_window = Window_LxBack.new 
-     @lxc_window.y = 272 
-     @lxd_window = Window_LxBack.new 
-     @lxd_window.y = 376 
-     #过渡 
-     Graphics.transition 
-     #循环 
-     loop do 
-       Graphics.update 
-       Input.update 
-       update 
-       if $scene != self 
-         break 
-       end 
-     end 
-     Graphics.freeze 
-     #释放窗口 
-     @command_window.dispose 
-     @help_window.dispose 
-     @status_window.dispose 
-     @lxa_window.dispose 
-     @lxb_window.dispose 
-     @lxc_window.dispose 
-     @lxd_window.dispose 
-   end 
-   #刷新 
-   def update 
-     @command_window.update 
-     @status_window.update 
-     @help_window.update 
-     if Input.repeat?(Input::UP) or  Input.repeat?(Input::DOWN) 
-       @status_window.active = true 
-       return 
-     end 
-     if @status_window.active 
-       update_status 
-       return 
-     end 
-     if @command_window.active 
-       update_command 
-       return 
-     end 
-   end 
-   #刷新(状态窗口) 
-   def update_status 
-     @help_window.refresh      
-     if Input.trigger?(Input::B) 
-       $game_system.se_play($data_system.cancel_se) 
-       $scene = Scene_Map.new 
-       return 
-     end 
-     if Input.trigger?(Input::C) 
-       level = $game_party.actors[@status_window.index].level 
-       #限制 
-       if level >= LX_LEVEL 
-         if LX_DX == true 
-           i = $game_party.actors[@status_window.index].id 
-           if $game_variables[i + LX_VARIABLE] < LX_DX_N 
-             $game_system.se_play($data_system.decision_se) 
-             @status_window.active = false 
-             @command_window.visible = true 
-             @command_window.active = true 
-             @command_window.index = 0 
-           else 
-             $game_system.se_play($data_system.buzzer_se) 
-             text =  "已达转生次数上限!" 
-             @help_window.contents.clear 
-             @help_window.contents.draw_text(170,0, 246, 32, text) 
-             @status_window.active = false 
-           end 
-         else 
-           $game_system.se_play($data_system.decision_se) 
-           @status_window.active = false 
-           @command_window.visible = true 
-           @command_window.active = true 
-           @command_window.index = 0 
-         end 
-       else 
-         $game_system.se_play($data_system.buzzer_se) 
-         text = LX_LEVEL.to_s 
-         text +=  "级后才能转生!" 
-         @help_window.contents.clear 
-         @help_window.contents.draw_text(190,0, 186, 32, text) 
-         @status_window.active = false 
-       end 
-       return 
-     end 
-   end 
-   #刷新(选择窗口) 
-   def update_command 
-     if Input.trigger?(Input::B) 
-       $game_system.se_play($data_system.cancel_se) 
-       @status_window.active = true 
-       @command_window.visible = false 
-       @command_window.active = false 
-       @command_window.index = -1 
-       return 
-     end 
-     if Input.trigger?(Input::C) 
-       case @command_window.index 
-       when 0 
-         $game_system.se_play($data_system.decision_se) 
-         update_xdrs_lx 
-       when 1 
-         $game_system.se_play($data_system.cancel_se) 
-         @status_window.active = true 
-         @command_window.visible = false 
-         @command_window.active = false 
-         @command_window.index = -1 
-       end 
-       return 
-     end 
-   end 
-   #刷新(转生) 
-   def update_xdrs_lx 
-     #获取角色。 
-     actor = $game_party.actors[@status_window.index] 
-     i = actor.id 
-     #获取储存角色转生次数的变量ID. 
-     v = LX_VARIABLE + i 
-     #代入角色转生前的各数据,并计算最终增加的属性。 
-     n = $game_variables[v] + 1 
-     hp = actor.maxhp/LX_N * n 
-     sp = actor.maxsp/LX_N * n 
-     str = actor.str/LX_N * n 
-     dex = actor.dex/LX_N * n 
-     agi = actor.agi/LX_N * n 
-     int = actor.int/LX_N * n 
-     #角色初始化。 
-     $game_actors[i].setup(i) 
-     #确认转生后是否改变职业,是则变为设置的职业ID。 
-     if LX_CLASS == true 
-       actor.class_id = LX_CLASS_ID 
-     end 
-     #加入角色转生后增加的各种属性。 
-     actor.maxhp += hp 
-     actor.maxsp += sp 
-     actor.str += str 
-     actor.dex += dex 
-     actor.agi += agi 
-     actor.int += int 
-     #角色转生次数变量加 1 。 
-     $game_variables[v] += 1 
-     #回复。 
-     actor.recover_all 
-     #确认升级加点系统,转生后,如果有剩余点数未加,将变为 0 。 
-     #如果没有升级加点系统,跳过。 
-     if LEVEL_UP == true 
-       va = LEVEL_UP_VARIABLE + i 
-       $game_variables[va] = 0 
-     end 
-     #激活公共事件。 
-     $game_temp.common_event_id = LX_EVENT_ID 
-     #切换到地图场景。 
-     $scene = Scene_Map.new 
-   end 
- end 
- ############################################################################### 
- #============================================================================== 
- #★ 增加描绘转生次数的定义 
- #============================================================================== 
- class Window_Base < Window 
-   def draw_actor_xdrs_lx(actor, x, y) 
-     self.contents.font.color = text_color(3) 
-     self.contents.draw_text(8, 32, 120, 32, "转生次数:")  
-     i =  actor.id + LX_VARIABLE 
-     #self.z = 0 
-     self.contents.font.color = text_color(6) 
-     self.contents.draw_text(x,y, 80, 32, $game_variables[i].to_s) 
-   end 
- end 
- #=============================================================================== 
- #★ 帮助窗口 
- #=============================================================================== 
- class Window_LxHelp < Window_Base 
-   def initialize 
-     super(0, 0, 640, 64) 
-     self.contents = Bitmap.new(width - 32, height - 32) 
-     refresh 
-   end 
-   def refresh 
-     self.contents.clear 
-     self.contents.draw_text(170, 0, 246, 32, "★请选择要转生的角色★") 
-   end 
- end 
- #=============================================================================== 
- #★ 选择窗口 
- #=============================================================================== 
- class Window_LxCommand < Window_Selectable 
-   def initialize 
-     super(240, 180, 160, 124) 
-     self.contents = Bitmap.new(width - 32, height - 32) 
-     @item_max = 2 
-     @commands = ["是", "否"] 
-     refresh 
-     self.z = 999 
-     self.active = false 
-     self.index = -1 
-   end 
-   def refresh 
-     self.contents.clear 
-     for i in 0...@item_max 
-       draw_item(i) 
-     end 
-   end 
-   def draw_item(index) 
-     self.contents.font.color = system_color 
-     self.contents.draw_text(0, 0, 148, 32, "是否确定转生?") 
-     y = 30 + index * 32 
-     self.contents.font.color = normal_color 
-     self.contents.draw_text(0, y, 126, 32, @commands[index]) 
-   end 
-   def update_cursor_rect 
-     self.cursor_rect.set(-5, 30 + index * 32, 134, 32) 
-   end 
- end 
- #=============================================================================== 
- #★ 角色状态 + 选择角色窗口 
- #=============================================================================== 
- class Window_LxStatus < Window_Selectable 
-   def initialize 
-     super(0, 64, 1200, 700) 
-     self.contents = Bitmap.new(width - 32, height - 32) 
-     self.opacity = 0 
-     refresh 
-     self.index = 0 
-   end 
-   def refresh 
-     self.contents.clear 
-     @item_max = $game_party.actors.size 
-     for i in 0...$game_party.actors.size 
-     x = ( i + 1 ) * 92 +25 
-     y = 44 
-   
-     @column_max = 4 
-   
-     actor = $game_party.actors[i] 
-     bitmap = Bitmap.new ("Graphics/Status/" + actor.id. to_s + "_h") #RPG::Cache.character(actor.character_name, actor.character_hue) 
-     cw = bitmap.width 
-     ch = bitmap.height 
-     src_rect = Rect.new(0, 0, cw, ch) 
-     self.contents.blt(x - ch , y - cw/ 2, bitmap, src_rect)  
-     #  x = 5 
-     #  y = i * 104 - 3 
-     #  actor = $game_party.actors[i] 
-       draw_actor_xdrs_lx(actor, x + 56, y + 130) 
-       draw_actor_graphic(actor, x + 35, y + 80) 
-       draw_actor_name(actor, x, y) 
-       draw_actor_class(actor, x + 134, y + 28) 
-       draw_actor_level(actor, x + 134, y) 
-       draw_actor_exp(actor, x + 300, y + 56) 
-       draw_actor_hp(actor, x + 300, y ) 
-       draw_actor_sp(actor, x + 300, y + 26) 
-     end 
-   end 
-  def update_cursor_rect 
-     # 光标位置不满 0 的情况下 
-     if @index <= -1 
-       self.cursor_rect.empty 
-   
-       return 
-     end 
-     # 获取当前的行 
- #    row = @index / @column_max 
-     # 当前行被显示开头行前面的情况下 
-   #  if row < self.top_row 
-       # 从当前行向开头行滚动 
-  #     self.top_row = row 
-  #   end 
-     # 当前行被显示末尾行之后的情况下 
-  #   if row > self.top_row + (self.page_row_max - 1) 
-       # 从当前行向末尾滚动 
-  #     self.top_row = row - (self.page_row_max - 1) 
-  #   end 
-     # 计算光标的宽 
-     cursor_width = 90 
-     #cursor_width = 536 / (@column_max + 1) + 1  #光标大小 
-     # 计算光标坐标 
-   
-     x = 0 + @index % @column_max * (cursor_width + 1) - 4 #光标位置调节 覆盖31行 
-     y = @index / @column_max * 32 - self.oy 
-     # 更新国标矩形 
-     self.cursor_rect.set(x, y, cursor_width, 128)#(x, y, cursor_width, 32)  
-   
-     end 
-   
- end   
-   
- #  def update_cursor_rect 
- #    self.cursor_rect.set(- 12, @index * 104 - 12 , self.width - 4 , 96) 
- #  end 
- #end 
- #=============================================================================== 
- #★ 状态窗口背景 
- #=============================================================================== 
- class Window_LxBack < Window_Base 
-   def initialize 
-     super(0, 0, 640, 104) 
-     self.contents = Bitmap.new(width - 32, height - 32) 
-   end 
- end 
- #=============================================================================== 
- #★ 重新描绘其它状态窗口,增加描绘转生次数。 
- #=============================================================================== 
- class Window_Status < Window_Base 
-   def refresh 
-     self.contents.clear 
-     draw_actor_graphic(@actor, 40, 112) 
-     draw_actor_name(@actor, 4, 0) 
-     draw_actor_class(@actor, 4 + 144, 0) 
-     draw_actor_level(@actor, 96, 32) 
-     draw_actor_state(@actor, 96, 64) 
-     draw_actor_hp(@actor, 96, 112, 172) 
-     draw_actor_sp(@actor, 96, 144, 172) 
-     draw_actor_parameter(@actor, 96, 192, 0) 
-     draw_actor_parameter(@actor, 96, 224, 1) 
-     draw_actor_parameter(@actor, 96, 256, 2) 
-     draw_actor_parameter(@actor, 96, 304, 3) 
-     draw_actor_parameter(@actor, 96, 336, 4) 
-     draw_actor_parameter(@actor, 96, 368, 5) 
-     draw_actor_parameter(@actor, 96, 400, 6) 
-     draw_actor_xdrs_lx(@actor, 315, 0) 
-     self.contents.font.color = system_color 
-     self.contents.draw_text(320, 48, 80, 32, "EXP") 
-     self.contents.draw_text(320, 80, 80, 32, "NEXT") 
-     self.contents.font.color = normal_color 
-     self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2) 
-     self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2) 
-     self.contents.font.color = system_color 
-     self.contents.draw_text(320, 160, 96, 32, "装备") 
-     draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208) 
-     draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 256) 
-     draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 304) 
-     draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 352) 
-     draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 400) 
-   end 
-   def dummy 
-     self.contents.font.color = system_color 
-     self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon) 
-     self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1) 
-     self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2) 
-     self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3) 
-     self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4) 
-     draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144) 
-     draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208) 
-     draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272) 
-     draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336) 
-     draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400) 
-   end 
- end 
- #============================================================================== 
-   
- ################################################################################ 
- class Window_MenuStatus < Window_Selectable 
-   def refresh 
-     self.contents.clear 
-     @item_max = $game_party.actors.size 
-     for i in 0...$game_party.actors.size 
-     x = ( i + 1 ) * 92 +25 
-     y = 44 
-   
-     @column_max = 4 
-   
-     actor = $game_party.actors[i] 
-     bitmap = Bitmap.new ("Graphics/Status/" + actor.id. to_s + "_h") #RPG::Cache.character(actor.character_name, actor.character_hue) 
-     cw = bitmap.width 
-     ch = bitmap.height 
-     src_rect = Rect.new(0, 0, cw, ch) 
-     self.contents.blt(x - ch , y - cw/ 2, bitmap, src_rect)   
-    #   x = 64 
-     #  y = i * 116 
-     #  actor = $game_party.actors[i] 
- #      draw_actor_graphic(actor, x - 40, y + 80) 
-     draw_actor_xdrs_lx(actor, 60, y) 
-  #     draw_actor_name(actor, x, y) 
-  #     draw_actor_class(actor, x + 144, y) 
-  #     draw_actor_level(actor, x, y + 32) 
-  #     draw_actor_state(actor, x + 90, y + 32) 
-  #     draw_actor_exp(actor, x, y + 64) 
-  #     draw_actor_hp(actor, x + 236, y + 32) 
-  #     draw_actor_sp(actor, x + 236, y + 64) 
-     end 
-   end 
- end