#============================================================================== # ■ Game_Party #------------------------------------------------------------------------------ # 处理同伴的类。包含金钱以及物品的信息。本类的实例 # 请参考 $game_party。 #============================================================================== class Game_Party #-------------------------------------------------------------------------- # ● 增加武器 (减少) # weapon_id : 武器 ID # n : 个数 #-------------------------------------------------------------------------- def gain_weapon(weapon_id, n) a = 0 for i in 1..$data_weapons.size a += $game_party.weapon_number(i) end return p "超过武器携带上限" if a >= 40 # 更新 hash 的个数数据 if weapon_id > 0 @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min end end end
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# 处理同伴的类。包含金钱以及物品的信息。本类的实例
# 请参考 $game_party。
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# ● 增加武器 (减少)
# weapon_id : 武器 ID
# n : 个数
#--------------------------------------------------------------------------
def gain_weapon(weapon_id, n)
a = 0
for i in 1..$data_weapons.size
a += $game_party.weapon_number(i)
end
return p "超过武器携带上限" if a >= 40
# 更新 hash 的个数数据
if weapon_id > 0
@weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
end
end
end
物品 防具也可以参照以上方法 |