$VIPArcherScript ||= {};$VIPArcherScript[:load] = __FILE__
module VIPArcher end
module VIPArcher::Load
Default_Load = 1
Width = 150
Load_Name = "负重:"
Load_Var = 0
Load_Eval = "((mhp + mmp) / agi) * [hp_rate,0.5].max"
Stop_SW = false
Movable = true
Move_Speed = 2
Message = "负重超过承受范围,移动将变得\ec[10]【十分艰难!】\\c[0]" +
"\n\ei[4]丢弃些没用的东西吧。"
Lose_SW = true
Help_SW = true
Equip_SW = true
end
class RPG::BaseItem
include VIPArcher::Load
def load
return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
return $1.to_i if @note =~ /<(?:load|负重|負重)\s*(\d+)>/i
Default_Load
end
def description
if Help_SW && load && load != 0
@description + "\n\e}重量:#{load}\e{"
else
@description
end
end unless $VIPArcherScript[:help_ex]
end
class Window_Load < Window_Base
include VIPArcher::Load
def initialize(viewport)
super(Graphics.width - window_width, 72, window_width, fitting_height(1))
self.viewport = @viewport
refresh
end
def window_width
Width
end
def refresh
contents.clear
contents.font.size - 4
change_color(system_color)
draw_text(0, 0, window_width - 64, 24,Load_Name,0)
change_color($game_party.load_max? ? power_down_color : normal_color)
weight = "#{$game_party.current_load}/#{$game_party.total_load}"
draw_text(0, 0, window_width - 24, 24, weight,2)
@temp_load = $game_party.current_load
end
def update
super
refresh if @temp_load != $game_party.current_load
end
end
class Window_ItemCategory < Window_HorzCommand
include VIPArcher::Load
def window_width
scene_item_is? ? Graphics.width - Width : Graphics.width
end
def col_max
return scene_item_is? ? 3 : 4
end
def scene_item_is?
return SceneManager.scene_is?(Scene_Item)
end
end
class Scene_Item < Scene_ItemBase
include VIPArcher::Load
alias load_start start
def start
load_start
@load_window = Window_Load.new(@viewport)
end
alias load_update update
def update
if Input.trigger?(Input::X) && Lose_SW
item = @item_window.item
if item.is_a?(RPG::Item) && item.key_item? || item.nil?
Sound.play_buzzer
else
Sound.play_cancel
$game_party.lose_item(item, 1)
@item_window.refresh
end
end
load_update
end
end
class Window_ShopNumber < Window_Selectable
include VIPArcher::Load
attr_accessor :buy_or_sell
alias vip_shopnumber_refresh refresh
def refresh
vip_shopnumber_refresh
draw_current_weight(@item)
end
def draw_current_weight(item)
current = $game_party.current_load
weight = current + item.load * @number * (@buy_or_sell ? 1 : -1)
width = contents_width - 8
cx = text_size(@currency_unit).width
change_color(system_color)
draw_text(4, y + 60, width, line_height, Load_Name)
change_color(normal_color)
wt = "#{weight} / #{$game_party.total_load}"
change_color(power_down_color) if weight > $game_party.total_load
draw_text(4, y + 60, width, line_height, wt, 2)
end
end
class Window_ShopStatus < Window_Base
include VIPArcher::Load
alias vip_shopstatus_refresh refresh
def refresh
vip_shopstatus_refresh
draw_weight_occupy(4, 24)
end
def draw_weight_occupy(x, y)
rect = Rect.new(x, y, contents.width - 4 - x, line_height)
change_color(system_color)
draw_text(rect, Load_Name, 3)
change_color(normal_color)
weight = "#{$game_party.current_load}/#{$game_party.total_load}"
change_color(power_down_color) if $game_party.load_max?
draw_text(rect, weight, 2)
@temp_load = $game_party.current_load
end
end
class Game_Party < Game_Unit
include VIPArcher::Load
attr_accessor :current_load, :load_trade_item
alias load_initialize initialize
def initialize
load_initialize
total_load
@current_load = 0
@total_load = 0
end
def total_load
return $game_variables[Load_Var] if Load_Var > 0
all_members.inject(0) {|total,actor| total + actor.load }
end
def load_max?
return false if @current_load == 0
@current_load >= total_load
end
alias load_gain_item gain_item
def gain_item(item, n, include_equip = false)
return if item.nil?
load_gain_item(item, n, include_equip)
@current_load += item.load * n unless @load_trade_item
end
end
class Game_Actor < Game_Battler
include VIPArcher::Load
def trade_item_with_party(new_item, old_item)
return false if new_item && !$game_party.has_item?(new_item)
$game_party.load_trade_item = true if Equip_SW == true
$game_party.gain_item(old_item, 1)
$game_party.lose_item(new_item, 1)
$game_party.load_trade_item = false if Equip_SW == true
return true
end
def load
eval(Load_Eval).to_i rescue msgbox "请检查负重能力公式是否正确"
end
end
class Game_Interpreter
include VIPArcher::Load
alias load_command_126 command_126
def command_126
n = operate_value(@params[1], @params[2], @params[3])
return command_115 if check_load($data_items[@params[0]], n) && Stop_SW
load_command_126
end
alias load_command_127 command_127
def command_127
n = operate_value(@params[1], @params[2], @params[3])
return command_115 if check_load($data_weapons[@params[0]], n) && Stop_SW
load_command_127
end
alias load_command_128 command_128
def command_128
n = operate_value(@params[1], @params[2], @params[3])
return command_115 if check_load($data_armors[@params[0]], n) && Stop_SW
load_command_128
end
def check_load(item, n)
if (((item.load * n) + $game_party.current_load) > $game_party.total_load)
$game_message.texts.push("#{Message}") if $game_message.visible != true
$game_message.visible = true
end
((item.load * n) + $game_party.current_load) > $game_party.total_load
end
end
class Game_Player < Game_Character
include VIPArcher::Load
alias load_movable? movable?
def movable?
return false if $game_party.load_max? && !Movable ; load_movable?
end
def real_move_speed
return super - Move_Speed if $game_party.load_max? && Movable ; super
end
end
class Window_ShopBuy < Window_Selectable
alias load_enable? enable?
def enable?(item)
load_enable?(item) && !$game_party.load_max?
end
end
class Scene_Shop < Scene_MenuBase
alias vip_load_command_buy command_buy
def command_buy
vip_load_command_buy ; @number_window.buy_or_sell = true
end
alias vip_load_command_sell command_sell
def command_sell
vip_load_command_sell ; @number_window.buy_or_sell = false
end
alias load_max_buy max_buy
def max_buy
vip = @item.load == 0 ? load_max_buy : ($game_party.total_load -
$game_party.current_load) / @item.load
[load_max_buy,vip].min
end
end