Project1

标题: 当175号物品持有时增加100点负重最大值公式该怎么改? [打印本页]

作者: shengfeng    时间: 2018-6-2 15:01
标题: 当175号物品持有时增加100点负重最大值公式该怎么改?

  1. class RPG::BaseItem
  2.   def load
  3.     return if self.is_a?(RPG::Skill)
  4.     self.note.split(/[\r\n]+/).each { |line|
  5.       if line =~ /\[(?:load|负重|負重) (\w+)\]/
  6.         return $1.nil? ? 0 : $1.to_i
  7.       end}
  8.     return 0
  9.   end
  10. end

  11. class Scene_Item < Scene_ItemBase
  12.   alias load_start start
  13.   alias load_terminate terminate
  14.   alias load_update update
  15.   def start
  16.     load_start
  17.     @load_window = Window_Base.new(392, 0, 152, 56)
  18.     @load_window.viewport = @viewport
  19.   end
  20.   def terminate
  21.     @load_window.dispose
  22.     load_terminate
  23.   end
  24.   def update
  25.     @load_window.update
  26.     if @temp_load != $game_party.current_load
  27.       @load_window.contents.clear
  28.       @load_window.contents.draw_text(0, 0, 120, 24, "负重:#{$game_party.current_load}/#{$game_party.total_load}")
  29.       @temp_load = $game_party.current_load
  30.     end
  31.     if Input.trigger?(Input::X)
  32.       @item = @item_window.item
  33.       $game_party.lose_item(@item, 1)
  34.       @item_window.refresh
  35.     end
  36.     load_update
  37.   end
  38. end

  39. class Scene_Shop < Scene_MenuBase
  40.   alias load_start start
  41.   alias load_terminate terminate
  42.   alias load_update update
  43.   def start
  44.     load_start
  45.     @load_window = Window_Base.new(392, 0, 152, 56)
  46.     @load_window.viewport = @viewport
  47.   end
  48.   def terminate
  49.     @load_window.dispose
  50.     load_terminate
  51.   end
  52.   def update
  53.     @load_window.update
  54.     if @temp_load != $game_party.current_load
  55.       @load_window.contents.clear
  56.       @load_window.contents.draw_text(0, 0, 120, 24, "负重:#{$game_party.current_load}/#{$game_party.total_load}")
  57.       @temp_load = $game_party.current_load
  58.     end
  59.     load_update
  60.   end
  61. end

  62. class Game_Party < Game_Unit
  63.   attr_reader :current_load
  64.   alias load_initialize initialize
  65.   alias load_gain_item gain_item
  66.   def initialize
  67.     load_initialize
  68.     @current_load = 0
  69.   end
  70.   # 获取队伍最大负重
  71.   def total_load
  72.     party_load = 0
  73.     #members.size.times do |i|
  74.     for i in 0...members.size
  75.       actor = members[i]
  76.       party_load += actor.load
  77.     end
  78.     return party_load
  79.    
  80.   end

  81.   def gain_item(item, n, include_equip = false)
  82.     return if item.nil?
  83.       load_gain_item(item, n, include_equip)
  84.       @current_load += item.load * n
  85.   end
  86. end
  87. class Game_Actor < Game_Battler
  88.   # 获取队员负重
  89.   def load
  90.     return (mhp + mmp) * @level / agi  # 获取队员负重的公式
  91.   end
  92. end
  93. class Game_Interpreter
  94.   alias load_command_126 command_126
  95.   alias load_command_127 command_127
  96.   alias load_command_128 command_128
  97.   
  98.   def command_126
  99.     n = operate_value(@params[1], @params[2], @params[3])
  100.     return command_115 if check_load(@params[0], 0, n)
  101.     load_command_126
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # ● 增減武器
  105.   #--------------------------------------------------------------------------
  106.   def command_127
  107.     n = operate_value(@params[1], @params[2], @params[3])
  108.     return command_115 if check_load(@params[0], 1, n)
  109.     load_command_127
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ● 增減防具
  113.   #--------------------------------------------------------------------------
  114.   def command_128
  115.     n = operate_value(@params[1], @params[2], @params[3])
  116.     return command_115 if check_load(@params[0], 2, n)
  117.     load_command_128
  118.   end
  119.   
  120.   def check_load(item_id, type, n)
  121.     case type
  122.     when 0; item = $data_items[item_id]
  123.     when 1; item = $data_weapons[item_id]
  124.     when 2; item = $data_armors[item_id]
  125.     end
  126.     if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
  127.       $game_message.texts.push("负重已满,无法移动") if $game_message.visible != true
  128.       $game_message.visible = true
  129.     end
  130.     return
  131.   end
  132. end
  133. class Game_Player < Game_Character
  134.   
  135.   alias vipmovable? movable?
  136.   #--------------------------------------------------------------------------
  137.   # ● 判定是否负重已满
  138.   #--------------------------------------------------------------------------
  139.   def mfz_vip?
  140.     $game_party.total_load < $game_party.current_load
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   # ● 判定是否可以移动
  144.   #--------------------------------------------------------------------------
  145.   def movable?
  146.     return false if mfz_vip?
  147.     vipmovable?
  148.   end
  149. end

  150. class Window_ShopBuy < Window_Selectable
  151.   
  152.   #--------------------------------------------------------------------------
  153.   # ● 判定是否负重已满
  154.   #--------------------------------------------------------------------------
  155.   def mfz_vip?
  156.     $game_party.total_load <= $game_party.current_load
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 查询商品是否可买
  160.   #--------------------------------------------------------------------------
  161.   def enable?(item)
  162.     item && price(item) <= @money && !$game_party.item_max?(item) && !mfz_vip?
  163.   end
  164. end
  165. class Scene_Shop < Scene_MenuBase
  166.   #--------------------------------------------------------------------------
  167.   # ● 获取可以买入的最大值
  168.   #--------------------------------------------------------------------------
  169.   def max_buy
  170.     vip = ($game_party.total_load - $game_party.current_load) / @item.load
  171.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  172.     buying_price == 0 ? [max,vip].min : [max,vip, money / buying_price].min
  173.   end
  174. end
复制代码

作者: shengfeng    时间: 2018-6-2 15:05
在脚本第95行更改! 0/200
                                      ↓
                                   最大值




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